Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 1st, 2008  |  syntax: Python  |  size: 0.71 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import sys, socket, operator, os, codecs, wikipedia, urllib, gc, re, family, time
  2. site = wikipedia.getSite()
  3. evilcontribs = '/w/index.php?title=Special:Contributions&limit=3000&contribs=user&target=AkhtaBot'
  4.  
  5. def main():
  6.   regexp = re.compile('<span class="mw-rollback-link">(?P<url>.+?)" title="', re.UNICODE)
  7.   html = site.getUrl(evilcontribs)
  8.   for m in regexp.finditer(html):
  9.     try:
  10.       url = wikipedia.html2unicode(m.group('url')).replace('[<a href="', '')
  11.       print time.strftime('[%H:%M:%S] Rolling back an edit...')
  12.       temp = site.getUrl(url)
  13.     except:
  14.       print sys.exc_info()[0]
  15.       print sys.exc_info()[1]
  16.  
  17. if __name__ == "__main__":
  18.   try:
  19.     main()
  20.   finally:
  21.     wikipedia.stopme()
clone this paste RAW Paste Data