Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Added Twitch override of Worlds 2022.
Browse files Browse the repository at this point in the history
Window waits for user input when webdriver initialization fails.
  • Loading branch information
LeagueOfPoro committed Sep 30, 2022
1 parent a6e74b8 commit 57cf4ae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"https://lolesports.com/live/cblol-brazil":"https://lolesports.com/live/cblol-brazil/cblol",
"https://lolesports.com/live/pcs/lXLbvl3T_lc":"https://lolesports.com/live/pcs/lolpacific",
"https://lolesports.com/live/ljl_academy/ljl":"https://lolesports.com/live/ljl_academy/riotgamesjp",
"https://lolesports.com/live/european-masters":"https://lolesports.com/live/european-masters/EUMasters"
"https://lolesports.com/live/european-masters":"https://lolesports.com/live/european-masters/EUMasters",
"https://lolesports.com/live/worlds":"https://lolesports.com/live/worlds/riotgames",
}

def createWebdriver(browser, headless):
Expand Down Expand Up @@ -100,7 +101,7 @@ def logIn(driver, username, password):
log.info("Credentials submitted")

# check for 2FA
time.sleep(5);
time.sleep(5)
if len(driver.find_elements(by=By.CSS_SELECTOR, value="div.text__web-code")) > 0:
insertTwoFactorCode(driver)

Expand Down Expand Up @@ -220,7 +221,14 @@ def checkRewards(driver, url, retries=5):

if not (isHeadless and hasAutoLogin):
log.info("Consider using the headless mode for improved performance and stability.")
driver = createWebdriver(browser, isHeadless and hasAutoLogin)

try:
driver = createWebdriver(browser, isHeadless and hasAutoLogin)
except Exception as ex:
print(ex)
print("CANNOT CREATE A WEBDRIVER!\nPress any key to exit...")
input()
exit()

driver.get("https://lolesports.com/schedule")

Expand Down

0 comments on commit 57cf4ae

Please sign in to comment.