forked from piair/MsRewards-Reborn
small changes, the real fix vas to update chrome and undetected chromedriver
This commit is contained in:
parent
e75a28104d
commit
ef686799a8
37
V6.py
37
V6.py
@ -1,8 +1,5 @@
|
||||
#!/usr/bin/python3.10
|
||||
from modules.imports import *
|
||||
from modules.config import *
|
||||
from modules.db import add_to_database
|
||||
from modules.tools import *
|
||||
from modules.error import *
|
||||
from modules.driver_tools import *
|
||||
from modules.cards import *
|
||||
@ -13,7 +10,7 @@ display = g.display
|
||||
|
||||
|
||||
# create a webdriver
|
||||
def firefox_driver(mobile=False, headless=False):
|
||||
def create_driver(mobile=False, headless=False):
|
||||
PC_USER_AGENT = (
|
||||
"Mozilla/5.0 (X11; Linux x86_64)"
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko)"
|
||||
@ -38,24 +35,24 @@ def firefox_driver(mobile=False, headless=False):
|
||||
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
|
||||
if ldriver is None:
|
||||
ldriver = driver
|
||||
if type(error) != str:
|
||||
if l_driver is None:
|
||||
l_driver = driver
|
||||
if type(error) is not str:
|
||||
error = format_error(error)
|
||||
printf(f"\n\n\033[93m Erreur : {str(error)} \033[0m\n\n")
|
||||
if g.discord_enabled_error:
|
||||
with open("page.html", "w") as f:
|
||||
try:
|
||||
f.write(ldriver.page_source)
|
||||
f.write(l_driver.page_source)
|
||||
except:
|
||||
f.write("the driver has closed or crashed. Can't access page content")
|
||||
try:
|
||||
img = display.waitgrab()
|
||||
img.save("screenshot.png")
|
||||
except:
|
||||
ldriver.save_screenshot("screenshot.png")
|
||||
l_driver.save_screenshot("screenshot.png")
|
||||
if not log:
|
||||
embed = Embed(
|
||||
title="An Error has occured",
|
||||
@ -161,7 +158,7 @@ def play_quiz8():
|
||||
custom_sleep(3)
|
||||
|
||||
|
||||
def play_quiz4(override=None):
|
||||
def play_quiz4(override: int = None):
|
||||
printf("play_quiz4 : start")
|
||||
if not override:
|
||||
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)):
|
||||
global mobile_driver
|
||||
mobile_driver = firefox_driver(mobile=True)
|
||||
mobile_driver = create_driver(mobile=True)
|
||||
try:
|
||||
login(mobile_driver)
|
||||
mot = choice(Liste_de_mot).replace(" ", "+")
|
||||
@ -791,7 +788,7 @@ def CustomStart():
|
||||
if len(cred) == 3:
|
||||
g._otp = TOTP(cred[2])
|
||||
|
||||
driver = firefox_driver()
|
||||
driver = create_driver()
|
||||
driver.implicitly_wait(3)
|
||||
if login(driver) != "STOP":
|
||||
if "tout" in Actions:
|
||||
@ -849,12 +846,12 @@ def very_custom_start(json):
|
||||
pass
|
||||
# print(f"none is set to \"{j}\"")
|
||||
if start:
|
||||
driver = firefox_driver()
|
||||
driver = create_driver()
|
||||
try:
|
||||
if str(i) in json["unban"]:
|
||||
pwd_login(driver) # TODO : define only the first part of login
|
||||
print("\nGO TO exmaple.com TO PROCEED or wait 600 secs.")
|
||||
for _ in range(600):
|
||||
print("\nGO TO example.com TO PROCEED or wait 1200 secs.")
|
||||
for _ in range(1200):
|
||||
sleep(1)
|
||||
if driver.current_url == "https://example.com/":
|
||||
print("proceeding")
|
||||
@ -917,17 +914,15 @@ else:
|
||||
display = SmartDisplay(size=(1920, 1080))
|
||||
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:
|
||||
driver = firefox_driver()
|
||||
driver = create_driver()
|
||||
# input("kill ?")
|
||||
driver.quit()
|
||||
elif g.custom_start:
|
||||
CustomStart()
|
||||
elif g.unban:
|
||||
g._mail, g._password = select_accounts(False)[0]
|
||||
driver = firefox_driver()
|
||||
driver = create_driver()
|
||||
try:
|
||||
login(driver)
|
||||
except Banned:
|
||||
@ -946,7 +941,7 @@ else:
|
||||
g._otp = TOTP(cred[2])
|
||||
custom_sleep(1)
|
||||
printf("Début du driver.")
|
||||
driver = firefox_driver()
|
||||
driver = create_driver()
|
||||
printf("Driver demarré.")
|
||||
driver.implicitly_wait(3)
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user