2014-01-12 31 views
0

我试图从新闻机构刮来的文章,但我无法弄清楚如何得到一篇文章的作者使用python鹅。我已阅读文档,源代码和搜索谷歌。我如何得到一篇文章的作者使用蟒蛇

from goose import Goose 

def getArticle(url): 
    g = Goose() 
    article = g.extract(url=url) 
    print article.title 
    # print article.author 
    # print article.writer 

那么,有没有内置的方式来提取使用python-goose的文章的作者?

链接,蟒蛇鹅代码和documenation:http://github.com/grangier/python-goose

回答

1

their documentation

鹅会尝试提取以下信息:

  • 文章
  • 的正文文章的主要图像
  • 任何Youtube/Vimeo电影em床第
  • meta描述
  • Meta标签

他们不答应让笔者;您需要查看元数据以了解它是否包含并手动提取。

0

报纸可能会满足您的要求。

这里的用法:>>> article.authors [u'Leigh安考德威尔”, '约翰Honway']

你可以找到它的文档或Github上的更多细节。 http://newspaper.readthedocs.org/en/latest/

它非常简单而强大。