oui
This commit is contained in:
parent
c9076d4eaa
commit
eeaf084aee
32
V4.py
32
V4.py
@ -66,6 +66,13 @@ webhookSuccess = Webhook.from_url(SuccessLink, adapter=RequestsWebhookAdapter())
|
|||||||
webhookFailure = Webhook.from_url(ErrorLink, adapter=RequestsWebhookAdapter())
|
webhookFailure = Webhook.from_url(ErrorLink, adapter=RequestsWebhookAdapter())
|
||||||
|
|
||||||
|
|
||||||
|
def resource_path(relative_path): #permet de recuperer l'emplacement de chaque fichier, sur linux et windows
|
||||||
|
try:
|
||||||
|
base_path = sys._MEIPASS
|
||||||
|
except Exception:
|
||||||
|
base_path = path.dirname(__file__)
|
||||||
|
return path.join(base_path, relative_path)
|
||||||
|
|
||||||
|
|
||||||
def FirefoxMobile(Headless = Headless):
|
def FirefoxMobile(Headless = Headless):
|
||||||
MOBILE_USER_AGENT = ('Mozilla/5.0 (iPhone; CPU iPhone OS 14_8_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1')
|
MOBILE_USER_AGENT = ('Mozilla/5.0 (iPhone; CPU iPhone OS 14_8_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1')
|
||||||
@ -78,23 +85,27 @@ def FirefoxMobile(Headless = Headless):
|
|||||||
|
|
||||||
|
|
||||||
def FirefoxPC(Headless = Headless):
|
def FirefoxPC(Headless = Headless):
|
||||||
PC_USER_AGENT = ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.46')
|
PC_USER_AGENT = ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
|
||||||
|
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
||||||
|
'Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134')
|
||||||
options = Options()
|
options = Options()
|
||||||
options.set_preference("general.useragent.override", PC_USER_AGENT)
|
options.set_preference("general.useragent.override", PC_USER_AGENT)
|
||||||
|
|
||||||
options.set_preference("browser.link.open_newwindow", 3)
|
options.set_preference("browser.link.open_newwindow", 3)
|
||||||
|
|
||||||
if Headless :
|
if Headless :
|
||||||
options.add_argument("-headless")
|
options.add_argument("-headless")
|
||||||
|
|
||||||
|
|
||||||
return(webdriver.Firefox(options=options))
|
return(webdriver.Firefox(options=options))
|
||||||
|
|
||||||
|
|
||||||
def printf(txt, end="", Mobdriver = None):
|
def printf(txt, end="", Mobdriver = driver):
|
||||||
if Log :
|
if Log :
|
||||||
Timer(txt)
|
Timer(txt)
|
||||||
if FullLog :
|
if FullLog :
|
||||||
try :
|
LogError(txt, Mobdriver=Mobdriver)
|
||||||
LogError(txt, Mobdriver=Mobdriver)
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
def CustomSleep(temps):
|
def CustomSleep(temps):
|
||||||
if Log or not IsLinux :
|
if Log or not IsLinux :
|
||||||
@ -136,6 +147,7 @@ def LogError(message,log = FullLog, Mobdriver = None):
|
|||||||
if IsLinux :
|
if IsLinux :
|
||||||
with open('page.html', 'w') as f:
|
with open('page.html', 'w') as f:
|
||||||
f.write(gdriver.page_source)
|
f.write(gdriver.page_source)
|
||||||
|
|
||||||
gdriver.save_screenshot("screenshot.png")
|
gdriver.save_screenshot("screenshot.png")
|
||||||
if not log :
|
if not log :
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
@ -151,6 +163,7 @@ def LogError(message,log = FullLog, Mobdriver = None):
|
|||||||
url = ListTabs(Mdriver=Mobdriver)[0],
|
url = ListTabs(Mdriver=Mobdriver)[0],
|
||||||
colour = Colour.blue()
|
colour = Colour.blue()
|
||||||
)
|
)
|
||||||
|
|
||||||
file = discord.File("screenshot.png")
|
file = discord.File("screenshot.png")
|
||||||
embed.set_image(url="attachment://screenshot.png")
|
embed.set_image(url="attachment://screenshot.png")
|
||||||
embed.set_footer(text=_mail)
|
embed.set_footer(text=_mail)
|
||||||
@ -334,9 +347,10 @@ def AllCard(): #fonction qui clique sur les cartes
|
|||||||
printf(f"Allcard card {titre} error ({e})")
|
printf(f"Allcard card {titre} error ({e})")
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
LogError(f'Dailycards {e}')
|
LogError(f'Dailycards {e}')
|
||||||
|
try :
|
||||||
dailyCards()
|
dailyCards()
|
||||||
|
except :
|
||||||
|
printf("erreur ici")
|
||||||
try :
|
try :
|
||||||
try :
|
try :
|
||||||
driver.find_element(By.XPATH, '/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]').click() #declenche la premiere partie ?
|
driver.find_element(By.XPATH, '/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]').click() #declenche la premiere partie ?
|
||||||
|
Loading…
Reference in New Issue
Block a user