如何将变量解析为wget调用?

时间:2019-02-22 12:31:42

标签: python scripting automation

〜/ .scripts / url2txt.py

URL = input("Enter a URL ")

# print (URL) //in place originally to verify my input was not the cause for failure

f"wget -O- https://{URL} | lynx -dump -stdin > ~/Documents/name.txt"

运行:

python ~/.scripts/url2txt.py 输入网址,然后按enter

如果我跑步,什么都不会发生

wget -O- https://www.website.com/2019/02/some-article | lynx -dump -stdin > ~/Documents/name.txt


我需要编辑什么,以便下载 article / blog 并自动使用文章名称命名输出txt文件?大概在最后/之后截断,而regex用空格替换-_。我得到了我需要做的事情的构想,我无法全神贯注于如何做。


我知道html2txtpandoc。但是,lynx的输出格式与我需要的格式更加接近。

0 个答案:

没有答案