How can I get the Infobox from a Wikipedia article by the MediaWiki API? [duplicate]
Wikipedia articles may have Infobox templates. By the following call I can get the first section of an article which includes an Infobox.
http://en.wikipedia.org/w/api.php?action=parse&pageid=568801§ion=0&prop=wikitext
I want a query which will return only Infobox data. Is this possible?
You can do it with a URL call to the Wikipedia API like this:
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=xmlfm&titles=Scary%20Monsters%20and%20Nice%20Sprites&rvsection=0
Replace the titles=
section with your page title, and format=xmlfm
to format=json
if you want the article in JSON format.
Instead of parsing infoboxes yourself, which is quite complicated, take a look at DBPedia, which has Wikipedia infoboxes extracted out as database objects.