User:Firefly/code/nulledits


 * 1) !/usr/bin/python
 * 2) -*- coding: utf-8  -*-
 * 3) Relevant BRFA: Irrelevant, null edits only
 * 4) Coded by: User:Richard0612 using pywikipedia library
 * 5) Description:
 * 6) Script to make a null edit to all pages in a category to fix category borking

import wikipedia import catlib import pagegenerators import time def main: site = wikipedia.getSite cat = catlib.Category(site, 'Category:Wikipedia_pages_with_broken_references')

for page in pagegenerators.CategorizedPageGenerator(cat, start='Takatof'): try: text = page.get except wikipedia.Error: wikipedia.output(u'Error: skipping..') text = '' if page.isTalkPage: try: page.put(text, 'Bot: null') except: time.sleep(5) if __name__ == '__main__': try: main finally: wikipedia.stopme