2014-01-12 42 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/

它非常簡單而強大。