如何使用维基百科api获取维基百科文章信息框中的信息? [英] How to get information in info box of Wikipedia articles using Wikipedia api?
本文介绍了如何使用维基百科api获取维基百科文章信息框中的信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从电影的维基百科文章中获取男主角的名字.
I'm trying to get lead actor's name from movie's Wikipedia article.
我为 prop 尝试了不同的值,prop=info 似乎最相关.但这不包含维基百科文章信息框中的信息.
I tried different values for prop, prop=info seems most relevant. But this doesn't contain the information in info box of Wikipedia article.
见:
http://en.wikipedia.org/w/api.php?action=query&prop=info&titles=Casino_Royale_(2006_film)&format=jsonfm
是否可以使用 Wikipedia API 提取 infobox 中的信息?
Is it possible to extract information in infobox using Wikipedia API?
推荐答案
MediaWiki API 不理解信息框.因此,您基本上有两个选择:
The MediaWiki API doesn't understand infoboxes. So, you have basically two options:
- 自己解析信息框.您可以直接解析 wikitext,也可以解析生成的 HTML 表格(两者都可以从 API 中获得).
- 让其他人进行解析.这正是 DBPedia 所做的.Wikidata 尝试做类似的事情,但它可能不会包含足够长时间可用的数据;请参阅增长统计数据.
- Parse the infobox yourself. You can either parse the wikitext directly or the generated HTML table (both are available from the API).
- 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.
这篇关于如何使用维基百科api获取维基百科文章信息框中的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文