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:RevertBotCleaner.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Script written by Filnik it.wiki to clean [[w:it:User:RevertBot/Report]] """ # Version: 1.5 # License: MIT import wikipedia import re def main(): wikipedia.output(u'Starting...') addtext = """{{RevertBot|mese={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}""" templateName = 'Template:RevertBot' busypage = 'Utente:RevertBot/Report' site = wikipedia.getSite() wikipage = wikipedia.Page(site, busypage) revertText1 = wikipage.get() wikipedia.output(u'Provo a sistemare la pagina del RevertBot...') revertText = re.sub('\n+', '\n', revertText1) #revertText = re.sub('\n\n', '\n', revertText) if revertText != revertText1: wikipedia.output(u'Trovato qualcosa da sistemare...') wikipage.put(revertText, 'Bot: Tolgo i doppi spazi') else: wikipedia.output(u'...tutto ok...') copyvioledpages = re.findall('=== ?\[\[(.*?)\]\](.*?) ?===', revertText) skip = True lista = list() ok = False wikipedia.output(u'Inizio a controllare dai ref...') templatePage = wikipedia.Page(site, templateName) for refPagina in templatePage.getReferences(True, True, True): RefOk = False for l in copyvioledpages: if refPagina.title() in l: wikipedia.output(u'%s found, ok.' % refPagina.title()) RefOk = True break if RefOk == False: try: testoRef = refPagina.get() except wikipedia.NoPage(): wikipedia.output(u'Page not found!') continue testoNuovo = re.sub(r'\{\{([Tt]emplate:|)[Rr]evertBot(.*?)?\}\}') refPagina.put(testoNuovo, "Bot: Tolgo template RevertBot dato che e' stata tolta la segnalazione") for i in copyvioledpages: for p in ['', ' ', ' ']: if i[1] == p: skip = False break if skip == True: continue else: if 1:#if 'tomba del tuffatore' == i[0].lower(): ok = True if ok == True: lista.append(i[0]) else: continue wikipedia.output(u'Inizio ora a controllare i template apposti...') for article in lista: articlewiki = wikipedia.Page(site, article) try: wikipedia.output(u'Loading %s...' % article) text = articlewiki.get() except Exception, e: if 'KeyboardInterrupt' in e: exit() wikipedia.output(u'%s skipped...' % article) continue if 'controlcopy' in text.lower(): wikipedia.output(u'Controlcopy already put in the page!') elif '{{revertbot' in text.lower(): wikipedia.output(u'{{RevertBot}} already found') else: newtext = addtext + '\n' + text articlewiki.put(newtext, 'Bot: Aggiungo avviso controlcopy') wikipedia.output(u'Program finished.') if __name__ == "__main__": try: main() finally: wikipedia.stopme()