Mwclient: Rename categories

From Glitchdata
Jump to navigation Jump to search

This script renames looks at all pages with a specified category.


page = site.pages['mwclient']

for page in site.Categories['mwclient']:
    print page.page_title
    text = page.text()
    text = text.replace('[[Category:mwclient]]', '[[Category:mwclients]]')
    page.save(text, summary='Renaming category mwclient to mwclients')