2014-02-27 61 views
1

我使用Python Newspaper lib开发了网页抓取脚本。我需要提取以下内容 - 网址,标题,摘要,作者和出版日期。除了发布日期之外,我收到了所有的内容我的问题是,有没有人使用报纸库来捕获出版日期?用于在Python中进行网页抓取的报纸0.0.6

hn.write("***********Article no" + str(x+1) + "************\r\n"); 
hn.write("URL: "+ article.url+ "\r\n"); 
hn.write("Title: "+ article.title + "\r\n"); 
hn.write("Authors: "+' '.join(map(str, article.authors))); 
hn.write("\r\n"); 
hn.write("Summary: "+ article.summary+ "\r\n); 
hn.write("Key words: "); 
hn.write(str(article.keywords).strip('[]')); 

有没有办法使用报纸库获取发布日期?

感谢

穆克什

回答

3

有一个在newspaper/article.py

# TODO self.publish_date = self.config.publishDateExtractor.extract(self.doc) 

线195现在看来,这是还没有准备好。但是你可以试着取消注释这段代码。

来源:https://github.com/codelucas/newspaper/blob/master/newspaper/article.py#L195

+1

Furas,谢谢...我注释掉行和执行脚本。它给我解析错误!我想我必须等待这个功能才能实现。 – user3358819

+1

请[报纸作者](https://github.com/codelucas)寻求帮助。 – furas