我想从wikipedia页面获取主图像,我有所有wikipedia实体名称,从中创建wiki链接并从该页面获取主图像。在
我试过了
https://github.com/richardasaurus/wiki-api,https://github.com/goldsmith/Wikipedia
但这并不适用于所有页面,尽管页面包含图像。在
from wikiapi import WikiApi
wiki = WikiApi()
wiki = WikiApi({ 'locale' : 'es'})
def getWikiImage(entity):
results = wiki.find(entity)
print results
if len(results):
article = wiki.get_article(results[0])
print article.image
#getWikiImage("Rudy Sarzo")
getWikiImage("Melody Gersbach")
位于http://www.mediawiki.org/wiki/API:Client_code#Python的mediawiki api已签出,但似乎没有帮助。在
下面是一个小例子,如何获取wikipage,主图像应该是页面上的第一个。在
签出Quickstart guide for Wikipedia API.
相关问题 更多 >
编程相关推荐