【发布时间】:2018-11-15 09:03:57
【问题描述】:
通过使用 python 的newspaper 模块,我可以通过以下方式从文章中获取顶部图像:
from newspaper import Article
first_article = Article(url="http://www.lemonde.fr/...", language='fr')
first_article.download()
first_article.parse()
print(first_article.top_image)
但我需要获取文章中的所有图片。他们的 github 文档说:'从 html 中提取所有图像' 是可能的。但我无法弄清楚这一点。而且我不想手动下载 html 文件并将其保存在硬盘驱动器中,然后将文件提供给模块并获取图像。
我可以通过什么方式做到这一点?
【问题讨论】:
-
newspaper.readthedocs.io/en/latest/#features what are you see
all image extraction from htmlisfeatures,他们现在没有这个 -
@zimdero,你是什么意思?特征就是存在的东西。顶部图像提取也是一项功能,并在文档中进行了描述
-
我的意思是将来会,但是现在他们没有这个功能来获取所有图像
-
@zimdero,编辑了我的评论
-
也许他们实现了
top_image功能但all_image不完整,我不知道,我也搜索了问题的响应,我没有找到任何东西,你可以试试@Bear Brown 代码示例也许会对您有所帮助
标签: python django web-scraping python-newspaper