def main(): if int(now_localized().strftime('%H')) != 23: return credentials = AuthCredentials(user_file="me") site = EsportsClient('lol', credentials=credentials) # Set wiki pages = get_pages_to_make() for k in pages.keys(): # print(k) try: site.save_tile(k, text=pages[k], summary="Automatic GCD Backup") site.touch_title(k) except Exception as e: ERRORS.append(str(e)) if len(ERRORS) > 0: # for sure wait out any rate limiting time.sleep(30) site.save_tile(ERROR_REPORT_PAGE, text='<br>'.join(ERRORS))
from river_mwclient.esports_client import EsportsClient from river_mwclient.auth_credentials import AuthCredentials import mwparserfromhell, re credentials = AuthCredentials(user_file="bot") site = EsportsClient('lol', credentials=credentials) # set wiki summary = 'Changing links/display to be just 1 field, with link only' # Set summary limit = -1 startat_page = None print(startat_page) startat_page = 'Challengers Korea/2017 Season/Spring Season/Scoreboards/Week 3' this_template = site.client.pages['Module:Scoreboard'] # Set template pages = this_template.embeddedin() #pages = [site.pages['Data:Challengers Korea/2019 Season/Spring Season']] def links_to_display(template): if not template.has('name'): return name = template.get('name').value.strip() if '{{!}}' in name: template.add('name', name.split('{{!}}')[0]) name = template.get('name').value.strip() if not template.has('link'): template.add('link', name, before='name') template.remove('name') return display_str = template.get('name').value.strip() link_str = template.get('link').value.strip()
from river_mwclient.esports_client import EsportsClient from river_mwclient.auth_credentials import AuthCredentials import mwparserfromhell, datetime import re from dateutil import parser credentials = AuthCredentials(user_file="me") site = EsportsClient('lol', credentials=credentials) # Set wiki summary = 'Attempting to migrate content to data ns' # Set summary page_type = 'players' # players or teams limit = -1 startat_page = None print(startat_page) # startat_page = 'Nukeduck' template_types = {"players": 'Player', "teams": 'Team'} this_template = site.client.pages['Template:Infobox ' + template_types[page_type]] # Set template pages = this_template.embeddedin() tabs_templates = ['TDRight', 'TabsDynamic', 'TD'] years = [ '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019' ] months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'September', 'October', 'November', 'December' ] # pages = [
continue if not tl_has(template, 'mh'): continue if tl_has(template, 'blue') and tl_has(template, 'red') and tl_has( template, 'winner'): continue if 'gameHash' not in template.get('mh').value.strip(): continue mh_url = (template.get('mh').value.strip()) # print(mh_url) game = lol_esports_parser.get_riot_game(mh_url, add_names=False) blue = game["teams"]["BLUE"]['name'] red = game["teams"]["RED"]['name'] blue_team = self.site.cache.get_team_from_event_tricode( overview_page, blue) red_team = self.site.cache.get_team_from_event_tricode( overview_page, red) if blue_team is not None and red_team is not None: template.add('blue', blue_team) template.add('red', red_team) if game["winner"] == "BLUE": template.add('winner', "1") elif game["winner"] == "RED": template.add('winner', "2") if __name__ == '__main__': credentials = AuthCredentials(user_file='me') site = EsportsClient('lol', credentials=credentials) # Set wiki MhToWinnersRunner(site).run()
import time from collections import OrderedDict from river_mwclient.wiki_client import WikiClient from river_mwclient.auth_credentials import AuthCredentials credentials = AuthCredentials(user_file="wc") site = WikiClient('pcj-testing-ucp.fandom.com', credentials=credentials) FROM_WIKI_ID = 2293615 FROM_WIKI_NAME = 'Leaguepedia' TO_WIKI_ID = 2415957 SKIP_PARAMS = [ 'wgSitename', 'wgMetaNamespace', 'wgUploadPath', 'wgUploadDirectory', 'wgLogo', 'wgLocalInterwiki', 'wgCacheEpoch', 'wgDartCustomKeyValues', 'wgWikiDirectedAtChildrenByFounder', 'wgWikiDescription', 'wgEnableHydraFeatures', 'wgDefaultSkin', 'wgActorTableSchemaMigrationStage', 'wgUCPMigrationDone', 'wgUCPMigrationDate', 'wgAdDriverPagesWithoutAds', 'wgEnableAudioButton', 'wgWidgetsCompileDir', 'dsSiteKey' ] ALREADY_PARAMS = ['wgEnableUserEmail', 'wgLanguageCode', 'wgRestrictionLevels'] OKAY_PARAMS = [ 'wgEnableUserEmail', 'wgRestrictionLevels', 'wgNamespacesToBeSearchedDefault', 'wgExtraNamespacesLocal', 'wgRightsText', 'wgRightsIcon', 'wgContentNamespaces', 'wgGroupPermissionsLocal', 'wgWikiaEnableDPLExt', 'wgEnableGadgetsExt', 'wgEnableLoopsExt', 'wgAddGroupsLocal', 'wgRemoveGroupsLocal', 'wgRestrictDisplayTitle', 'wgEnableAbuseFilterExtension', 'wgEnableArrayExt', 'wgCargoPageDataColumns', 'wgClaimWikiEnabled',
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()