starting to enable fidelity once again

This commit is contained in:
piair 2022-04-10 18:43:33 +02:00
parent 979a3275ce
commit 9acd0f6f45
1 changed files with 30 additions and 13 deletions

41
V4.py
View File

@ -9,7 +9,7 @@ from random import choice, randint, shuffle, uniform
from re import findall, search from re import findall, search
from sys import platform from sys import platform
from time import sleep, time from time import sleep, time
from requests import get
import discord import discord
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
Colour, Embed, RequestsWebhookAdapter, Webhook) Colour, Embed, RequestsWebhookAdapter, Webhook)
@ -53,7 +53,7 @@ MotPath = config["DEFAULT"]["motpath"]
LogPath = config["DEFAULT"]["logpath"] LogPath = config["DEFAULT"]["logpath"]
SuccessLink = config["DEFAULT"]["successlink"] SuccessLink = config["DEFAULT"]["successlink"]
ErrorLink = config["DEFAULT"]["errorlink"] ErrorLink = config["DEFAULT"]["errorlink"]
fidelity = config["DEFAULT"]["fidelity"]
embeds = config["DEFAULT"]["embeds"] == "True" embeds = config["DEFAULT"]["embeds"] == "True"
Headless = config["DEFAULT"]["headless"] == "True" Headless = config["DEFAULT"]["headless"] == "True"
@ -631,7 +631,7 @@ def TryPlay(nom ="inconnu"):
elif search("([0-9]) de ([0-9]) finalisée",driver.page_source) : elif search("([0-9]) de ([0-9]) finalisée",driver.page_source) :
print('fidélité') print('fidélité')
RGPD() RGPD()
Fidelité() Fidelite()
else : else :
print(f'rien a faire sur la page {nom}') print(f'rien a faire sur la page {nom}')
@ -677,22 +677,24 @@ def LogPoint(account="unknown"): #log des points sur discord
webhookSuccess.send(f'{account} actuellement à {str(point)} points') webhookSuccess.send(f'{account} actuellement à {str(point)} points')
def Fidelité(): def Fidelite(lien):
try : try :
driver.switch_to.window(driver.window_handles[1]) driver.get(lien)
choix = driver.find_element(By.CLASS_NAME,'spacer-48-bottom') sleep(2)
nb = search("([0-9]) de ([0-9]) finalisée",driver.page_source) 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)
print(choix, nb)
for i in range(int(nb[2])-int(nb[1])): for i in range(int(nb[2])-int(nb[1])):
choix = driver.find_element(By.CLASS_NAME,'spacer-48-bottom') choix = driver.find_element(By.CLASS_NAME,'spacer-48-bottom')
ButtonText = search('<span class=\"pull-left margin-right-15\">([^<^>]+)</span>',choix.get_attribute("innerHTML"))[1] ButtonText = search('<span class=\"pull-left margin-right-15\">([^<^>]+)</span>',choix.get_attribute("innerHTML"))[1]
bouton = driver.find_element(By.XPATH, f'//span[text()="{ButtonText}"]') bouton = driver.find_element(By.XPATH, f'//span[text()="{ButtonText}"]')
bouton.click() bouton.click()
CustomSleep(uniform(3,5)) CustomSleep(uniform(3,5))
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1]) driver.switch_to.window(driver.window_handles[0])
TryPlay(driver.title) TryPlay(driver.title)
CustomSleep(uniform(3,5)) driver.get(lien)
Close(driver.window_handles[2],SwitchTo=1)
driver.refresh()
CustomSleep(uniform(3,5)) CustomSleep(uniform(3,5))
Close(driver.window_handles[1]) Close(driver.window_handles[1])
@ -746,6 +748,15 @@ def close():
driver.quit() driver.quit()
quit() quit()
def dev():
try :
result = get(fidelity)
lien = result.content.decode("UTF-8")
print(lien)
Fidelite(lien)
except Exception as e :
print(f"erreur dans la partie dev : {e}")
def CustomStart(Credentials): def CustomStart(Credentials):
global driver global driver
@ -753,7 +764,7 @@ def CustomStart(Credentials):
global _password global _password
ids = [x[0] for x in Credentials] #list of all email adresses ids = [x[0] for x in Credentials] #list of all email adresses
actions=["tout", "daily", "pc", "mobile", "LogPoint"] actions=["tout", "daily", "pc", "mobile", "LogPoint", "dev"]
system("clear") #clear from previous command to allow a clean choice system("clear") #clear from previous command to allow a clean choice
Comptes = enquiries.choose('quels comptes ?', ids, multi=True) Comptes = enquiries.choose('quels comptes ?', ids, multi=True)
@ -789,6 +800,12 @@ def CustomStart(Credentials):
except Exception as e: except Exception as e:
LogError(f'BingMobileSearch - {e} -- override') LogError(f'BingMobileSearch - {e} -- override')
if "dev" in Actions:
try :
dev()
except Exception as e :
printf(e)
break
try : try :
LogPoint(_mail) LogPoint(_mail)