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:Edpdelinker.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Program to delink EDP image for User namespace, written by Filnik """ import wikipedia def main(): site = wikipedia.getSite() pagina = wikipedia.Page(site, 'Template:EDP') acceptall = False for image in pagina.getReferences(False, True, True): if not 'Immagine:' in image.title(): wikipedia.output(u'%s is not an image...' % image.title()) continue else: wikipedia.output(u'Fixing %s...' % image.title()) realimage = image.title().split('Immagine:')[-1].replace(' ', '_') for paginaref in image.getReferences(): pagename = paginaref.title() wikipedia.output(u'Fixing %s...' % pagename) if 'utente:alfiobot' in pagename.lower(): wikipedia.output(u'AlfioBot report, skip!') continue if 'utente' in pagename.lower(): try: oldtext = paginaref.get() except wikipedia.NoPage: wikipedia.output(u"%s doesn't exist, skip." % pagename) continue except wikipedia.IsRedirectPage: wikipedia.output(u"%s è un redirect! Skip." % pagename) continue new_text = paginaref.removeImage(realimage, False) fixed = False if '[[:]]' in new_text: new_text = re.sub('\[\[:\]\]', '[[:%s]]' % image.title(), new_text) fixed = True if oldtext == new_text: continue wikipedia.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<" % pagename) wikipedia.showDiff(oldtext, new_text) if not acceptall: choice = wikipedia.inputChoice(u'Do you want to accept these changes?', ['Yes', 'No', 'All'], ['y', 'N', 'a'], 'N') if choice in ['a', 'A']: acceptall = True if acceptall or choice in ['y', 'Y']: try: paginaref.put(new_text, 'Bot: Tolgo immagine EDP dal namespace utente') except wikipedia.EditConflict: wikipedia.output(u'Skipping %s because of edit conflict' % (page.title(),)) except wikipedia.SpamfilterError, e: wikipedia.output(u'Cannot change %s because of blacklist entry %s' % (page.title(), e.url)) except wikipedia.LockedPage: wikipedia.output(u'Skipping %s (locked page)' % (page.title(),)) else: continue if __name__ == "__main__": try: main() finally: wikipedia.stopme()