small changes, the real fix vas to update chrome and undetected chromedriver

This commit is contained in:
piair 2024-02-22 09:38:17 +01:00
parent e75a28104d
commit ef686799a8
2 changed files with 17 additions and 22 deletions

37
V6.py
View File

@ -1,8 +1,5 @@
#!/usr/bin/python3.10 #!/usr/bin/python3.10
from modules.imports import *
from modules.config import * from modules.config import *
from modules.db import add_to_database
from modules.tools import *
from modules.error import * from modules.error import *
from modules.driver_tools import * from modules.driver_tools import *
from modules.cards import * from modules.cards import *
@ -13,7 +10,7 @@ display = g.display
# create a webdriver # create a webdriver
def firefox_driver(mobile=False, headless=False): def create_driver(mobile=False, headless=False):
PC_USER_AGENT = ( PC_USER_AGENT = (
"Mozilla/5.0 (X11; Linux x86_64)" "Mozilla/5.0 (X11; Linux x86_64)"
"AppleWebKit/537.36 (KHTML, like Gecko)" "AppleWebKit/537.36 (KHTML, like Gecko)"
@ -38,24 +35,24 @@ def firefox_driver(mobile=False, headless=False):
return (driver) return (driver)
def log_error(error, ldriver=driver, log=g.full_log): def log_error(error, l_driver=driver, log=g.full_log):
global driver global driver
if ldriver is None: if l_driver is None:
ldriver = driver l_driver = driver
if type(error) != str: if type(error) is not str:
error = format_error(error) error = format_error(error)
printf(f"\n\n\033[93m Erreur : {str(error)} \033[0m\n\n") printf(f"\n\n\033[93m Erreur : {str(error)} \033[0m\n\n")
if g.discord_enabled_error: if g.discord_enabled_error:
with open("page.html", "w") as f: with open("page.html", "w") as f:
try: try:
f.write(ldriver.page_source) f.write(l_driver.page_source)
except: except:
f.write("the driver has closed or crashed. Can't access page content") f.write("the driver has closed or crashed. Can't access page content")
try: try:
img = display.waitgrab() img = display.waitgrab()
img.save("screenshot.png") img.save("screenshot.png")
except: except:
ldriver.save_screenshot("screenshot.png") l_driver.save_screenshot("screenshot.png")
if not log: if not log:
embed = Embed( embed = Embed(
title="An Error has occured", title="An Error has occured",
@ -161,7 +158,7 @@ def play_quiz8():
custom_sleep(3) custom_sleep(3)
def play_quiz4(override=None): def play_quiz4(override: int = None):
printf("play_quiz4 : start") printf("play_quiz4 : start")
if not override: if not override:
try: # fidelity quiz are much longer than usual ones try: # fidelity quiz are much longer than usual ones
@ -701,7 +698,7 @@ def mobile_alert_popup():
def bing_mobile_search(override=randint(22, 25)): def bing_mobile_search(override=randint(22, 25)):
global mobile_driver global mobile_driver
mobile_driver = firefox_driver(mobile=True) mobile_driver = create_driver(mobile=True)
try: try:
login(mobile_driver) login(mobile_driver)
mot = choice(Liste_de_mot).replace(" ", "+") mot = choice(Liste_de_mot).replace(" ", "+")
@ -791,7 +788,7 @@ def CustomStart():
if len(cred) == 3: if len(cred) == 3:
g._otp = TOTP(cred[2]) g._otp = TOTP(cred[2])
driver = firefox_driver() driver = create_driver()
driver.implicitly_wait(3) driver.implicitly_wait(3)
if login(driver) != "STOP": if login(driver) != "STOP":
if "tout" in Actions: if "tout" in Actions:
@ -849,12 +846,12 @@ def very_custom_start(json):
pass pass
# print(f"none is set to \"{j}\"") # print(f"none is set to \"{j}\"")
if start: if start:
driver = firefox_driver() driver = create_driver()
try: try:
if str(i) in json["unban"]: if str(i) in json["unban"]:
pwd_login(driver) # TODO : define only the first part of login pwd_login(driver) # TODO : define only the first part of login
print("\nGO TO exmaple.com TO PROCEED or wait 600 secs.") print("\nGO TO example.com TO PROCEED or wait 1200 secs.")
for _ in range(600): for _ in range(1200):
sleep(1) sleep(1)
if driver.current_url == "https://example.com/": if driver.current_url == "https://example.com/":
print("proceeding") print("proceeding")
@ -917,17 +914,15 @@ else:
display = SmartDisplay(size=(1920, 1080)) display = SmartDisplay(size=(1920, 1080))
display.start() display.start()
# webhookFailure.send(f"Starting on this config", username="Check de lancement", avatar_url="https://cdn-icons-png.flaticon.com/512/1688/1688988.png")
if g.dev: if g.dev:
driver = firefox_driver() driver = create_driver()
# input("kill ?") # input("kill ?")
driver.quit() driver.quit()
elif g.custom_start: elif g.custom_start:
CustomStart() CustomStart()
elif g.unban: elif g.unban:
g._mail, g._password = select_accounts(False)[0] g._mail, g._password = select_accounts(False)[0]
driver = firefox_driver() driver = create_driver()
try: try:
login(driver) login(driver)
except Banned: except Banned:
@ -946,7 +941,7 @@ else:
g._otp = TOTP(cred[2]) g._otp = TOTP(cred[2])
custom_sleep(1) custom_sleep(1)
printf("Début du driver.") printf("Début du driver.")
driver = firefox_driver() driver = create_driver()
printf("Driver demarré.") printf("Driver demarré.")
driver.implicitly_wait(3) driver.implicitly_wait(3)
try: try:

View File

@ -1 +1 @@
v6.7.3 v6.7.4