# fix_bug_iabot.py import pywikibot as pw site = pw.Site() # Variables keyword = 'insource:/DeadURL/' oldtext = 'no" == DeadURL or "khĂ´ng' newtext = 'no' sumtext = 'Fix bug of IABot.' # Actions searchResults = site.search(keyword, namespaces = 0, total = 100) for result in searchResults: page = pw.Page(site, result.title()) text = page.get() page.text = text.replace(oldtext, newtext) try: page.save(summary = sumtext, minor = True, botflag = True) # Exception LockedPage except pw.LockedPage: print('Page [[' + page.title() + ']] is locked')