I need your help. I’m parsing wikipedia article and using Wikimedia api. I want to read the text between {{ }}. Here is my wikimedia api query. I tried but not found any luck. can any one please help me ? thank you so much.
def getCategory(title):
paramsd = {'action': 'query', 'prop': 'revisions', 'rvprop': 'content', 'format': 'xmlfm', 'rvsection': 0,'titles':title}
params = urllib.urlencode(paramsd)
req = urllib2.Request(url='http://en.wikipedia.org/w/api.php', data=params)
f = urllib2.urlopen(req)
You know, there are a few libraries already written for this exact purpose, in python there’s pywikipedia, and there are more for every language ever. There’s a list at http://www.mediawiki.org/wiki/API:Client_code#API_Access_Libraries that lists four libraries for python. I’d use one of those instead of rolling your own.