From 2bba6d82354279a98f689e7cec20300d52b47277 Mon Sep 17 00:00:00 2001 From: piair Date: Fri, 27 May 2022 14:07:52 +0200 Subject: [PATCH] =?UTF-8?q?erreur=20dans=20la=20partie=20fid=C3=A9lit?= =?UTF-8?q?=C3=A9=20si=20le=20lien=20=C3=A9tais=20pas=20bon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- V4.py | 64 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/V4.py b/V4.py index 9e38f1a..8531043 100755 --- a/V4.py +++ b/V4.py @@ -862,6 +862,7 @@ def LogPoint(account="unknown"): # log des points sur discord if sql_enabled : add_to_database(account, points) + def Fidelite(): try: while 1: #close all tabs @@ -869,39 +870,42 @@ def Fidelite(): Close(1) except: break + try : + result = get(FidelityLink) #get the url of fidelity page + except Exception as e : + printf(e) - result = get(FidelityLink) #get the url of fidelity page - lien = result.content.decode("UTF-8") - printf(lien) + if result : + lien = result.content.decode("UTF-8") + printf(lien) - if (lien.split(":")[0] == "https") or (lien.split(":")[0] == "http") : - - driver.get(lien) - sleep(2) - choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]') # pull-left spacer-48-bottom punchcard-row - nb = search("([0-9]) of ([0-9]) completed", driver.page_source) - if not nb: - nb = search("([0-9]) de ([0-9]) finalisé", driver.page_source) - for i in range(int(nb[2]) - int(nb[1])): - driver.refresh() - CustomSleep(2) - choix = driver.find_element(By.CLASS_NAME, "spacer-48-bottom") - ButtonText = search('([^<^>]+)',choix.get_attribute("innerHTML"))[1] - bouton = driver.find_element(By.XPATH, f'//span[text()="{ButtonText}"]') - bouton.click() - CustomSleep(uniform(3, 5)) - driver.switch_to.window(driver.window_handles[1]) - TryPlay(driver.title) + if (lien.split(":")[0] == "https") or (lien.split(":")[0] == "http") : + driver.get(lien) - CustomSleep(uniform(3, 5)) - try: - Close(driver.window_handles[1]) - except Exception as e: - printf(e) - - printf("on a reussit la partie fidélité") - else : - printf("lien invalide") + sleep(2) + choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]') # pull-left spacer-48-bottom punchcard-row + nb = search("([0-9]) of ([0-9]) completed", driver.page_source) + if not nb: + nb = search("([0-9]) de ([0-9]) finalisé", driver.page_source) + for i in range(int(nb[2]) - int(nb[1])): + driver.refresh() + CustomSleep(2) + choix = driver.find_element(By.CLASS_NAME, "spacer-48-bottom") + ButtonText = search('([^<^>]+)',choix.get_attribute("innerHTML"))[1] + bouton = driver.find_element(By.XPATH, f'//span[text()="{ButtonText}"]') + bouton.click() + CustomSleep(uniform(3, 5)) + driver.switch_to.window(driver.window_handles[1]) + TryPlay(driver.title) + driver.get(lien) + CustomSleep(uniform(3, 5)) + try: + Close(driver.window_handles[1]) + except Exception as e: + printf(e) + printf("on a reussit la partie fidélité") + else : + printf("lien invalide") except Exception as e: LogError("Fidélité" + str(e))