How to get information in info box of Wikipedia articles using Wikipedia api?

ⅰ亾dé卋堺 提交于 2019-12-18 09:40:24

问题


I'm trying to get lead actor's name from movie's Wikipedia article.

I tried different values for prop, prop=info seems most relevant. But this doesn't contain the information in info box of Wikipedia article.

See:

http://en.wikipedia.org/w/api.php?action=query&prop=info&titles=Casino_Royale_(2006_film)&format=jsonfm

Is it possible to extract information in infobox using Wikipedia API?


回答1:


The MediaWiki API doesn't understand infoboxes. So, you have basically two options:

  1. Parse the infobox yourself. You can either parse the wikitext directly or the generated HTML table (both are available from the API).
  2. Let somebody else do the parsing. This is exactly what DBPedia does. Wikidata tries to do something similar, but it probably won't contain enough data to be usable for a long time; see growth statistics.


来源:https://stackoverflow.com/questions/18327768/how-to-get-information-in-info-box-of-wikipedia-articles-using-wikipedia-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!