User:Drinibot
From Wikipedia, the free encyclopedia
This account runs a bot operated by User:Drini
The purpose of this bot is
- create capitalization redirects (like Giant steps for Giant Steps or Albert einstein for Albert Einstein)
and also the standard template and category functionalities (for TFD and CFD handling)
- Substing, renaming, removing templates. approved april 20 2006 by freakofnurture
- Moving, emptying, renaming categories. approved by pgk 31 july 2006
[edit] MoveCats.py
Wrapper for CFD handling. Copy the listing from CFD/Working and paste into 00CFDMoves.txt on the same directory as the script.
import re import subprocess rawfilename="00CFDmoves.txt" fi=open(rawfilename,'r') regex=re.compile(r".*[Cc]ategory:(?P<oldcat>.*) to [Cc]ategory:(?P<newcat>.*)$") for line in fi: m=regex.findall(line) if m: oldcat= m[0][0] newcat =m[0][1] print "MOVING <"+oldcat+"> -> <"+newcat+">" fromarg="-from:"+str(oldcat) toarg="-to:"+str(newcat) CFD="-summary:\"Wikipedia:Categories for deletion/Log/2006 September 21\"" summary = CFD + ":" + oldcat +" -> " + newcat l=["python","category.py","-putthrottle:2", "-batch",summary, "move", fromarg, toarg] subprocess.call(l) fromarg2=fromarg.replace(" ","_") l=["python","category.py", "-batch", summary, "move", fromarg2, toarg] subprocess.call(l) fi.close()
- Source code for the capitalization redirect task
- Source code to extract a list of entries from a "whatlinkshere" html page saved to disk.