【发布时间】:2019-01-18 12:16:38
【问题描述】:
我什至尝试过pypi.org 中的命令,但没有下载任何文章。
from newspaper import Article
url = 'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/'
article = Article(url)
article.download()
article.html
article.html 只给出空的 sting ' '。当我尝试 article.parse() 它给出错误 *
你必须先
download()一篇文章!
我已经尝试过解决方法
while article.download_state == ArticleDownloadState.NOT_STARTED:
# Raise exception if article download state does not change after 10 seconds
if slept > 9:
raise ArticleException('Download never started')
sleep(1)
slept += 1
仍然无法解决问题。
【问题讨论】:
-
我能够使用 Python 3.6 的
newspaper库下载和解析这篇文章。如果 HTML 显示为空白,则说明请求存在问题。 -
它对我不起作用,我找不到解决方案
标签: python web-scraping python-newspaper