利用者:Sudebot/Category:アルカーイダ
表示
#coding:utf-8 import wikipedia import catlib import pagegenerators def main(): a = 0 site = wikipedia.getSite() cat = catlib.Category(site,u"Category:アルカイダ") gen = pagegenerators.CategorizedPageGenerator(cat) for page in gen: try: print page,u"の読み込み中" text = page.get(force = False, get_redirect=False, throttle = True, sysop = False, change_edit_time = True) if text.find(u"Category:アルカイダ") != -1: newtext = text.replace(u"Category:アルカイダ",u"Category:アルカーイダ") else: continue page.put(newtext, comment=u"Category:アルカイダの修正依頼", watchArticle = None, minorEdit = True) except wikipedia.IsRedirectPage: # second except, prevent redirect wikipedia.output(u"リダイレクトです") except wikipedia.NoPage: wikipedia.output(u"ページが存在しません") except wikipedia.Error: # third exception, take the problem and print wikipedia.output(u"Some Error") if __name__ == '__main__': try: main() finally: wikipedia.stopme() site = wikipedia.getSite()