Пример #1
0
from mwrogue.esports_client import EsportsClient
from mwcleric.auth_credentials import AuthCredentials
import time
limit = -1
credentials = AuthCredentials(user_file="me")
site = EsportsClient('lol', credentials=credentials)  # Set wiki

pages = site.pages_using('Infobox Player')

# c = site.client.categories['Pages with script errors']

startat_page = 'HauHau'
passed_startat = False

lmt = 0
#for p in c:
for p in pages:
    if lmt == limit:
        break
    if p.name == startat_page:
        passed_startat = True
    if not passed_startat:
        continue
    lmt += 1
    print(p.name)
    site.touch(p)
    subpages = site.client.allpages(prefix=original_name + "/")
    for subpage in subpages:
        edit_subpage(subpage)
        move_page(subpage)
    tooltip_page = site.client.pages['Tooltip:' + original_name]
    move_page(tooltip_page)

pages = thispage.backlinks()
i = 0

# fix cases of both first letter lowercase and first letter uppercase
processor_lc = PageProcessor(orig_name_lc, new_name_lc)
processor_uc = PageProcessor(orig_name_uc, new_name_uc)
for page in pages:
    if i == limit:
        break
    i = i + 1
    processor_lc.run(page)
    processor_uc.run(page)
print("Blank editing...")
if init_move:
    for page in blank_edit_these:
        site.touch(page)
    make_disambig_page()
for p in SUBPAGES_TO_DELETE:
    page = site.client.pages[p.format(original_name)]
    if page.exists:
        site.delete(page, 'Deleting a disambiguation subpage left behind')

print("Done! If some pages stalled out you may still need to abort manually.")