Planning the future of Botwiki! - Help us bring Botwiki up to date, contribute to our strategy discussion, add bot scripts, and contribute manuals, guides, and tutorials! Almost anything related to bots, particularly those used to edit mediawiki, is welcome.
UNABLE TO EDIT? - We've experienced attacks by spambots lately and now require you to confirm your e-mail before you can edit (go to your preferences, enter an e-mail address, and request a confirmation e-mail, then go to your e-mail and click on the confirmation link). We also require new accounts to make a few edits and wait a few minutes before before you can create a page; however, if this is a problem contact us in #botwiki and we can manually confirm your account. Sorry for the inconvenience.
Python:TestPageMoveDetector.py
### testPageMoveDetector.py ### DETECT PAGEMOVE: THE SIMPLEST MECHANISM NOW; NEED MORE SOPHISTICATION ### IF THERE IS A PAGEMOVE, FLAG IT; MOVE PAGES AT THE END ## NICKED FROM [[python:revertAll.py]] - BECAUSE IT DOESN'T WORK ### SET-UP : THE PARAMETERS , THE MESSAGES, ETC siteName = 'botwiki.sno.cc' vandalName = 'Hillgentleman1' #IF YOUR COMMAND LINE DOESN'T SUPPORT UNICODE, # DO IT BY HAND HERE, # AND PRESS RETURN WHEN THE PROMPT "name of vandal" APPEARS timestamp = '' #SET THE TIMESTAMP HERE AND IGNORE THE MANUAL INPUT, IF YOU LIKE uclimit = 500 #SET IT TO 5000 FOR A ROBOT, IF YOU LIKE sandboxName ='Wikiversity:Sandbox' pagemoveWord= ' moved to ' x = raw_input('Name of vandal, UPPER CASE FIRST? ('+vandalName+')') if x!= '': vandalName = x a = raw_input('timestamp?') if a!= '': timestamp = a ### SUGGESTION: SET THE DEFAULT TIME LIMIT TO 2 HOURS, ### I.E. REVERTS ALL EDITS FROM AN IP-ADDRESS OR A USER ### TO WITHIN 2 HOURS (OR PERHAPS ONE DAY?) ### OPTIONAL PARAMETER: REVERT ALL THOSE AFTER A CERTAIN TIMESTAMP ### OR REVISION ID ### IMPORTING THE MODULES; CREATING THE SITE OBJECT import wikipedia import re import userContributions site = wikipedia.getSite() list = userContributions.userContributions(siteName,vandalName,timestamp) #userContributions.py IS NOT USING THE VARIABLE timestamp AT PRESENT ### REGEX SETUP ## DETECTING PAGEMOVES, MAY NEED SET UP FOR INDIVIDUAL WIKI FROM [[mediawiki:1movedto2]] movedfromX = re.compile( r'(?<=\[\[).*?(?=\]\]' + pagemoveWord + r')' , flags=re.U) movedtoX = re.compile( r'(?<=' + pagemoveWord + r'\[\[).*?(?=\]\])' , flags=re.U) moveList=[] for type , pageid , revid , ns, title , timestamp , minor , comment in list: mfList = movedfromX.findall(comment) mtList = movedtoX.findall(comment) print '*\ncOMMENT: ' , comment print mfList print mtList a='' ; b='' for j in mfList : a = j for j in mtList : b = j if b!='' and a!='': moveList.append((b,a)) # MOVE BACK FROM "moved to" TO "moved from" IF BOTH movedfromX AND movedtoX MATCH print '\n*PAGE MOVE DETECTED: FROM ' , a , ' TO ' , b ### MOVING THE PAGES BACK: ### IF THERE WERE A SEQUENCE OF PAGE MOVES, WE MOVE IT BACK IN A SEQUENCE for i,j in moveList: #p = wikipedia.Page(site,i) #MOVE FROM i TO j # MOVE IT, SETTING movetalkpage = True ; VALUE sysop LEFT AS DEFAULT (False) #p.move(j , 'bot-moving (see [[botwiki:python:revertAll.py]]), reversing the contribution of [[user:' + vandalName + ']]' , True) print 'bot-moving (see [[botwiki:python:revertAll.py]]) from [[' + i + ']] to [[' +j+ ']], reversing the contribution of [[user:' + vandalName + ']]' wikipedia.stopme()