Python 3.10 whouhou
This commit is contained in:
parent
b2beda0cfe
commit
ec881143cd
49
V4.py
49
V4.py
@ -4,11 +4,9 @@ from time import sleep
|
||||
from random import uniform, choice, randint,shuffle
|
||||
from re import search,findall
|
||||
from os import path, sys, system
|
||||
from requests import get
|
||||
import discord
|
||||
import asyncio
|
||||
from sys import platform, exc_info
|
||||
from socket import gethostbyname
|
||||
from sys import platform
|
||||
from csv import reader
|
||||
|
||||
from selenium import webdriver
|
||||
@ -55,9 +53,9 @@ def FirefoxMobile(Headless = Headless):
|
||||
|
||||
MobileProfile = webdriver.FirefoxProfile()
|
||||
MobileProfile.set_preference("general.useragent.override", MOBILE_USER_AGENT)
|
||||
options.profile = MobileProfile
|
||||
|
||||
|
||||
return(webdriver.Firefox(options=options, firefox_profile=MobileProfile, service_log_path=os.devnull))
|
||||
return(webdriver.Firefox(options=options, service_log_path=os.devnull))
|
||||
|
||||
|
||||
def FirefoxPC(Headless = Headless):
|
||||
@ -73,14 +71,15 @@ def FirefoxPC(Headless = Headless):
|
||||
|
||||
PcProfile = webdriver.FirefoxProfile()
|
||||
PcProfile.set_preference("general.useragent.override", PC_USER_AGENT)
|
||||
options.profile= PcProfile
|
||||
|
||||
return(webdriver.Firefox(options=options, firefox_profile=PcProfile,service_log_path=os.devnull))
|
||||
return(webdriver.Firefox(options=options,service_log_path=os.devnull))
|
||||
|
||||
|
||||
if IsLinux :
|
||||
MotPath = "/home/pi/MsReward/liste.txt"
|
||||
LogPath= "/home/pi/MsReward/login.csv"
|
||||
TokenPath = "/home/pi/MsReward/token.txt"
|
||||
MotPath = "./liste.txt"
|
||||
LogPath= "./login.csv"
|
||||
TokenPath = "./token.txt"
|
||||
else :
|
||||
MotPath = resource_path('D:\Documents\Dev\MsReward\liste/liste.txt')
|
||||
LogPath = resource_path('D:\Documents\Dev\MsReward\login/login.csv')
|
||||
@ -352,7 +351,7 @@ def AllCard(): #fonction qui repere le type de contenue et redireige sur la bonn
|
||||
if c ==20 :
|
||||
break
|
||||
try :
|
||||
link = findall('href="([^<]+)" title=""',driver.page_source)[3]
|
||||
link = findall('href="([^<]+)" title=""',driver.page_source)[3] #verifie si on a toujours des cartes
|
||||
except :
|
||||
break
|
||||
except Exception as e:
|
||||
@ -548,21 +547,16 @@ def BingMobileSearch(override = randint(20,25)):
|
||||
def TryPlay(nom ="inconnu"):
|
||||
|
||||
RGPD()
|
||||
|
||||
try :
|
||||
driver.find_element_by_id('rqStartQuiz').click() #start the quiz
|
||||
|
||||
number = driver.page_source.count('rqAnswerOption')
|
||||
|
||||
if number == 9:
|
||||
def play(number, override = -1) :
|
||||
match number :
|
||||
case 9 :
|
||||
try :
|
||||
print(f'Quiz 8 détécté sur la page {nom}')
|
||||
RGPD()
|
||||
PlayQuiz8()
|
||||
except Exception as e :
|
||||
printf(f'echec de PlayQuiz 8. Aborted {e}')
|
||||
|
||||
elif number == 5 :
|
||||
case 5 :
|
||||
try :
|
||||
print(f'Quiz 4 détécté sur la page {nom}')
|
||||
RGPD()
|
||||
@ -570,18 +564,22 @@ def TryPlay(nom ="inconnu"):
|
||||
print('Quiz 4 reussit')
|
||||
except Exception as e :
|
||||
printf(f'echec de PlayQuiz 4. Aborted {e}')
|
||||
|
||||
elif number == 3 :
|
||||
case 3 :
|
||||
try :
|
||||
RGPD()
|
||||
print(f'Quiz 2 détécté sur la page {nom}')
|
||||
PlayQuiz2()
|
||||
except Exception as e :
|
||||
printf(f'echec de PlayQuiz 2. Aborted {e}')
|
||||
|
||||
else :
|
||||
case _ :
|
||||
LogError('probleme dans la carte : il y a un bouton play et aucun quiz')
|
||||
try :
|
||||
driver.find_element_by_id('rqStartQuiz').click() #start the quiz
|
||||
number = driver.page_source.count('rqAnswerOption')
|
||||
play(number)
|
||||
|
||||
except :
|
||||
|
||||
if "bt_PollRadio" in driver.page_source :
|
||||
try :
|
||||
print('Poll détected', end ="\r")
|
||||
@ -590,6 +588,9 @@ def TryPlay(nom ="inconnu"):
|
||||
print('Poll reussit ')
|
||||
except Exception as e :
|
||||
printf(f'Poll aborted {e}')
|
||||
elif "rqQuestionState" in driver.page_source :
|
||||
printf("recover détécté")
|
||||
number = driver.page_source.count('rqAnswerOption')
|
||||
|
||||
elif search("([0-9]) de ([0-9]) finalisée",driver.page_source) :
|
||||
print('fidélité')
|
||||
@ -738,7 +739,7 @@ for i in Credentials :
|
||||
driver.quit()
|
||||
timer = uniform(120,360)
|
||||
print(f"finis. attente de {timer}s")
|
||||
CustomSleep()
|
||||
CustomSleep(timer)
|
||||
|
||||
except KeyboardInterrupt :
|
||||
print('canceled')
|
||||
|
Loading…
Reference in New Issue
Block a user