〜/ .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用空格替换-
或_
。我得到了我需要做的事情的构想,我无法全神贯注于如何做。
我知道html2txt
和pandoc
。但是,lynx
的输出格式与我需要的格式更加接近。