Beispiel #1
0
from river_mwclient.esports_client import EsportsClient
from river_mwclient.auth_credentials import AuthCredentials
from river_mwclient.page_modifier import PageModifierBase
from river_mwclient.wiki_time_parser import time_from_template


class PageModifier(PageModifierBase):
    def update_wikitext(self, wikitext):
        for template in wikitext.filter_templates():
            if not template.name.matches([
                    'MatchRecapS8', 'Scoreboard/Season 3',
                    'Scoreboard/Season 4', 'Scoreboard/Season 5',
                    'Scoreboard/Season 5', 'Scoreboard/Season 6',
                    'Scoreboard/Season 7', 'Scoreboard/Season 8'
            ]):
                continue
            date_time = time_from_template(template)
            if date_time is not None:
                template.add('dst', date_time.dst)


if __name__ == '__main__':
    credentials = AuthCredentials(user_file='bot')
    site = EsportsClient('lol', credentials=credentials)  # Set wiki
    PageModifier(site,
                 page_list=site.pages_using('Scoreboard/Button'),
                 summary="Fix dst").run()
Beispiel #2
0
import time
from mwclient.errors import ProtectedPageError

from river_mwclient.esports_client import EsportsClient
from river_mwclient.auth_credentials import AuthCredentials
import csv
import mwparserfromhell

credentials = AuthCredentials(user_file="bot")
site = EsportsClient('fortnite-esports', credentials=credentials)

for page in site.pages_using('Infobox Tournament'):
    text = page.text()
    if 'Tabs}}' not in text:
        text = '{{EmptyTournamentTabs}}\n' + text
        site.save(page, text, summary="Adding EmptyTournamentTabs")
from river_mwclient.esports_client import EsportsClient
from river_mwclient.auth_credentials import AuthCredentials
from mwclient.page import Page
import mwparserfromhell

credentials = AuthCredentials(user_file="bot")
site = EsportsClient('lol', credentials=credentials, max_retries=10)
summary = "Create speculated item redirect"

# Recently I did a bunch of file rearranging, but it was kinda incomplete in making *all* of the
# needed file redirects I needed, so I'm now trying to fix that

for item_page in site.pages_using('Infobox Item'):
	page: Page
	file_name = 'File:ItemSquare{}.png'.format(item_page.name)
	item = item_page.name
	
	item_page_text = item_page.text()
	
	# first try and find out from the Infobox Item template on the page what the redirect should be
	# this part of the script actually ended up with some self-redirects that I didn't want
	# because I didn't realize that people had filled in the |image= with the name of the item
	# unnecessarily....so I should have added a check for that
	# but whatever, it didn't really create THAT much extra work for myself
	used_infobox = False
	for template in mwparserfromhell.parse(item_page_text).filter_templates():
		template: mwparserfromhell.nodes.Template
		if not template.name.matches('Infobox Item'):
			continue
		if template.has('image'):
			target = template.get('image').value.strip()
Beispiel #4
0
			for tl in param.filter_templates():
				if not tl.name.matches('ChromaBox'):
					continue
				i = 1
				while tl.has('chroma' + str(i)):
					s = str(i)
					new_chroma = Template('ChromaSet/Line')
					add_param(new_chroma, tl, s, '')
					add_param(new_chroma, tl, s, 'hex1')
					add_param(new_chroma, tl, s, 'hex2')
					add_param(new_chroma, tl, s, 'name')
					add_param(new_chroma, tl, s, 'rp')
					add_special_param(new_chroma, tl, s)
					chromas.append(str(new_chroma))
					i += 1
		chroma_section = ['== Chromas ==', '{{{{ChromaSet|price={}|release={}'.format(price, release)]
		for chroma in chromas:
			chroma_section.append('|' + chroma)
		chroma_section.append('}}')
		self.current_text = self.current_text.replace(
			'{{ChampionSkinImageSections}}',
			'\n'.join(chroma_section) + '\n' + '{{ChampionSkinImageSections}}'
		)
		self.current_text = self.current_text.replace('\n\n\n', '\n')
		self.current_text = self.current_text.replace('\n\n', '\n')


PageModifier(site,
             page_list=site.pages_using('Infobox Skin'),
             summary=summary).run()
Beispiel #5
0
from river_mwclient.esports_client import EsportsClient
from river_mwclient.auth_credentials import AuthCredentials
import time
limit = -1
credentials = AuthCredentials(user_file="me")
site = EsportsClient('fortnite', credentials=credentials)  # Set wiki

pages = site.pages_using('Infobox Player')

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

startat_page = None
passed_startat = True

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)
Beispiel #6
0
                'text':
                '{{PlayerTabsHeader}}\n{{PlayerResults|show=everything}}',
            },
        ]
    },
]

summary = 'Automatically creating subpages/dependent pages'

credentials = AuthCredentials(user_file="bot")
site = EsportsClient('fortnite-esports', credentials=credentials)  # Set wiki

startat_page = 'Qlut0'
passed_startat = False

for i, page in enumerate(site.pages_using('Infobox Player')):
    if page.name == startat_page:
        passed_startat = True
    if not passed_startat:
        continue
    if page.namespace == 2:
        continue
    text = page.text()
    this_pages = None
    for page_set in pages_to_make:
        if page_set['match'] in text:
            this_pages = page_set['pages']
            break
    if this_pages is None:
        continue
    for item in this_pages:
Beispiel #7
0
from river_mwclient.esports_client import EsportsClient
from river_mwclient.auth_credentials import AuthCredentials
import time
limit = -1
credentials = AuthCredentials(user_file="me")
site = EsportsClient('lol', credentials=credentials) # Set wiki


pages = site.pages_using('Scoreboard/Header')

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

startat_page = None
passed_startat = True

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)
	text = p.text()
	try:
		p.save(text,'blank editing')
	except Exception as e:
		print('uh oh!!!!!!!!')