Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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&section=0&prop=wikitext 

I want a query which will return only Infobox data. Is this possible?

like image 554
Erdem Avatar asked Oct 03 '11 17:10

Erdem


People also ask

Is Wikipedia API free?

Wikipedia and other Wikimedia projects are free, collaborative repositories of knowledge, written and maintained by volunteers from around the world. The Wikimedia API gives you open access to add this free knowledge to your projects and apps.

What is infobox Wikipedia?

On wikis, an infobox is a table used to collect and present a subset of information about its subject, such as a document. It is a structured document containing a set of attribute–value pairs, and in Wikipedia represents a summary of information about the subject of an article.


1 Answers

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.

like image 142
Gaʀʀʏ Avatar answered Sep 19 '22 02:09

Gaʀʀʏ