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:Movesubcat.py
# -*- coding: Latin-1 -*- """ A little bot to move all the subcategory of a given parent category. Written for Benoni1 by Filnik FIXME: * The Bot must work not only with a given catname... """ # # (C) Filnik, 2006 # # Distributed under the terms of the MIT license. # # Version 1.0 # import os import catlib import wikipedia # A little trick to load the default parameters for arg in wikipedia.handleArgs(): pass site = wikipedia.getSite() cat = u"C'hoarier echedoù" parental_cat = "C'hoarier echedoù" # Main code try: category_to_move = list() categorynmspace = site.namespace(14) + ':' catitle = catlib.Category(site, categorynmspace + cat) main = catitle._parseCategory for i in main(): if site.namespace(14).lower() in i[-1].lower() or 'category' in i[-1].lower(): # Cutting the cat's name to work with them :-) name = i[-1].split(':') splitme = name[-1].split(' ') variable = splitme[-1] variable category_to_move += [variable] for e in category_to_move: fromItem = u"C'hoarier echedoù " + e toItem = u"C'hoarierien echedoù " + e command = u'category.py move -from:"%s" -to:"%s" -lang:br' % (fromItem, toItem) wikipedia.output('Using: command') # Summon category.py to do the dirty job for us. os.system(command.encode('latin-1')) wikipedia.output(u'Done.') finally: wikipedia.stopme()