Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Infobox data from Wikipedia?

Tags:

If I have the url to a page, how would I obtain the Infobox information on the right using MediaWiki webservices?

like image 716
tomxu Avatar asked Jul 22 '10 18:07

tomxu


People also ask

How do you get infobox on Wikipedia?

Finding the infobox There are two ways in which an editor typically locates which infobox they want to use: By browsing the set of all infoboxes via Wikipedia:List of infoboxes. By determining the name of a particular infobox used in a similar article.

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.


2 Answers

Use the Mediawiki API through this Python library: https://github.com/siznax/wptools

Usage:

import wptools so = wptools.page('Stack Overflow').get_parse() infobox = so.data['infobox'] print(infobox) 

Output:

{'alexa': '{{Increase}} 34 ( {{as of|2019|12|15|lc|=|y}} )',  'author': '[[Jeff Atwood]] and [[Joel Spolsky]]',  'caption': 'Screenshot of Stack Overflow in February 2017',  'commercial': 'Yes',  'content_license': '[[Creative Commons license|CC-BY-SA]] 4.0',  'current_status': 'Online',  'language': 'English, Spanish, Russian, Portuguese, and Japanese',  'launch_date': '{{start date and age|2008|9|15}}',  'logo': 'Stack Overflow logo.svg',  'name': 'Stack Overflow',  'owner': '[[Stack Exchange]], Inc.',  'programming_language': '[[C Sharp (programming language)|C#]]',  'registration': 'Optional',  'screenshot': 'File:Stack Overflow homepage, Feb 2017.png',  'type': '[[Knowledge market]]',  'url': '{{URL|https://stackoverflow.com}}'} 
like image 159
siznax Avatar answered Sep 25 '22 02:09

siznax


If you just want to parse the infobox or you want to get some digested data, a look at the DBPedia project: http://dbpedia.org

The DBPedia project scans the infoboxes in WP to create a RDF database from Wikipedia: https://github.com/dbpedia/extraction-framework/

like image 44
Pierre Avatar answered Sep 22 '22 02:09

Pierre