Revision: 7498 Author: alexsh Date: 2009-10-18 18:23:42 +0000 (Sun, 18 Oct 2009)
Log Message: ----------- ImagePage(): add getFileVersionHistory() API and fix bug in _loadInfo()
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-10-18 17:47:26 UTC (rev 7497) +++ trunk/pywikipedia/wikipedia.py 2009-10-18 18:23:42 UTC (rev 7498) @@ -3479,11 +3479,11 @@ # count 1 and no iicontinue mean first image revision is latest. self._latestInfo = info infos.append(info) - if count >= limit: + if limit == 1: break
- if count < limit and 'query-continue' in data: + if 'query-continue' in data and limit != 1: params['iistart'] = data['query-continue']['imageinfo']['iistart'] else: break @@ -3548,6 +3548,15 @@
""" result = [] + infos = self._loadInfo(500) + #API query + if infos: + for i in infos: + result.append((i['timestamp'], i['user'], "%s\xA1\xD1%s" % (i['width'], i['height']), i['size'], i['comment'])) + + return result + + #from ImagePage HTML history = re.search('(?s)<table class="wikitable filehistory">.+?</table>', self.getImagePageHtml()) if history: lineR = re.compile(r'<tr>(?:<td>.*?</td>){1,2}<td.*?><a href=".+?">(?P<datetime>.+?)</a></td><td>.*?(?P<resolution>\d+\xd7\d+) <span.*?>((?P<filesize>.+?))</span></td><td><a href=".+?"(?: class="new"|) title=".+?">(?P<username>.+?)</a>.*?</td><td>(?:.*?<span class="comment">((?P<comment>.*?))</span>)?</td></tr>')