Skip to content

Turns a Wikipedia infobox into a Python dictionary.

License

Notifications You must be signed in to change notification settings

YufanPaPa/wikitodict

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#wikitodict

This little script takes a Wikipedia article title and returns a Python dictionary based on that article's infobox.

##Usage Simply place the wikitodict module in your project directory and use like so:

>>> import wikitodict
>>> cheers = wikitodict.search('Cheers')
>>> cheers['genre']
u'Sitcom'
>>> cheers['num_seasons']
u'11'
>>> cheers['opentheme']
u'"Where Everybody Knows Your Name" <br />Performed by Gary Portnoy'

##Issues This is about as quick and dirty as it gets.

  • No error handling to speak of.
  • Results are still a little 'dirty' with html elements and user comments present in many dictionary values.
  • Not all key value pairs make sense. For example, the dictionary for 'Barack Obama' contains the key 'blank1' with the value 'Awards' and the key 'data1' with the value 'Nobel Peace Prize'. A much better result would be an entry with the key 'Awards' and the value 'Nobel Peace Prize'.

About

Turns a Wikipedia infobox into a Python dictionary.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%