http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8985
Revision: 8985 Author: xqt Date: 2011-02-19 11:35:33 +0000 (Sat, 19 Feb 2011) Log Message: ----------- update botlist.py for mw 1.17. Thanks DrTrigon for the first patch.
Modified Paths: -------------- trunk/pywikipedia/botlist.py
Modified: trunk/pywikipedia/botlist.py =================================================================== --- trunk/pywikipedia/botlist.py 2011-02-19 10:47:01 UTC (rev 8984) +++ trunk/pywikipedia/botlist.py 2011-02-19 11:35:33 UTC (rev 8985) @@ -88,15 +88,17 @@ pywikibot.put_throttle() # It actually is a get, but a heavy one. m1 = True offset = '' + if site.versionnumber == 17: + PATTERN = u'<li>(.*?) *((.*?),\s(.*?))(?:.*?)</li>' + else: + PATTERN = u'<li>(.*?) *((.*?),\s(.*?))</li>' while m1: text = site.getUrl(site.globalusers_address(offset=offset, group='Global_bot'))
m1 = re.findall(u'<li>.*?</li>', text) for item in m1: - m2 = re.search(u'<li>(.*?)((.*?),\s(.*?))</li>', item) + m2 = re.search(PATTERN', item) (bot, flag_local, flag_global) = m2.groups() - - bot = bot[:-2] flag_local = (flag_local[:2] == u'<a') flag_global = True # since group='Global_bot'
pywikipedia-svn@lists.wikimedia.org