From 4b0f33ae26e2efdcc6a1369f3c8e516018a4b31d Mon Sep 17 00:00:00 2001 From: piair Date: Sat, 24 Jun 2023 16:39:42 +0200 Subject: [PATCH] stable --- V6.py | 25 ++++++++++++++----------- modules/driver_tools.py | 35 +++++++++++++++++++++++++++++++++++ modules/imports.py | 1 + version | 2 +- 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/V6.py b/V6.py index 8d83ec6..878478d 100755 --- a/V6.py +++ b/V6.py @@ -16,24 +16,26 @@ display = g.display # create a webdriver def firefox_driver(mobile=False, headless=False): PC_USER_AGENT = ( - "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + "Mozilla/5.0 (X11; Linux x86_64)" "AppleWebKit/537.36 (KHTML, like Gecko)" - "Chrome/112.0.0.0 Safari/537.36 Edg/110.0.1587.56") + "Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.58" + ) MOBILE_USER_AGENT = ( - "Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X)" - "AppleWebKit/606.0.2 (KHTML, like Gecko)" - "CriOS/107.0.5060.64 Mobile/15E148 Safari/604.1" + "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)" + "AppleWebKit/537.36 (KHTML, like Gecko)" + "Chrome/%s Mobile Safari/537.36" ) chrome_options = webdriver.ChromeOptions() - #if mobile: - # chrome_options.add_argument(f"--user-agent={PC_USER_AGENT}") - #else : - # chrome_options.add_argument(f"--user-agent={MOBILE_USER_AGENT}") - ## disabled as it may cause detection + if mobile: + chrome_options.add_argument(f"--user-agent={PC_USER_AGENT}") + else : + chrome_options.add_argument(f"--user-agent={MOBILE_USER_AGENT}") + # disabled as it may cause detection if g.proxy_enabled: PROXY = f"{g.proxy_address}:{g.proxy_port}" # IP:PORT or HOST:PORT chrome_options.add_argument(f'--proxy-server={PROXY}') driver = uc.Chrome(options=chrome_options) + set_language() return(driver) @@ -433,7 +435,8 @@ def cookie_login(ldriver): printf("No cookies file Found.") return(False) except Exception as e: - log_error(f"Error performing cookies login. Trying with password instead. \n{str(e)}", driver) + #log_error(f"Error performing cookies login. Trying with password instead. \n{str(e)}", driver) + print("error with cookies login. IDK why (yet)") return(False) try : ldriver.refresh() diff --git a/modules/driver_tools.py b/modules/driver_tools.py index c99c627..33b316b 100644 --- a/modules/driver_tools.py +++ b/modules/driver_tools.py @@ -4,6 +4,41 @@ from modules.tools import * import modules.globals as g +def set_language(ldriver): + ldriver.get("chrome://settings/languages") + action = ActionChains(ldriver) + action.reset_actions() + # select langage + x_coord = 1200 + y_coord = 150 + action.move_by_offset(x_coord, y_coord).click().perform() + sleep(0.5) + # scroll down + action.reset_actions() + x_coord = 1210 + y_coord = 430 + action.move_by_offset(x_coord, y_coord).click().perform() + for i in range(5): + action.click().perform() + # choose french + action.reset_actions() + x_coord = 745 + y_coord = 572 + action.move_by_offset(x_coord, y_coord).click().perform() + # enter + action.reset_actions() + x_coord = 1163 + y_coord = 717 + action.move_by_offset(x_coord, y_coord).click().perform() + # put to the top + sleep(0.5) + action.reset_actions() + x_coord = 1257 + y_coord = 328 + action.move_by_offset(x_coord, y_coord).click().perform() + action.click().perform() + + def setup_proxy(ip: str, port: str) -> None: PROXY = f"{ip}:{port}" webdriver.DesiredCapabilities.FIREFOX['proxy'] = { diff --git a/modules/imports.py b/modules/imports.py index cb13950..941b4ba 100644 --- a/modules/imports.py +++ b/modules/imports.py @@ -21,6 +21,7 @@ from selenium.common.exceptions import (ElementClickInterceptedException, NoSuchElementException, StaleElementReferenceException, TimeoutException, WebDriverException) +from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.options import Options diff --git a/version b/version index ce19e4c..9773998 100644 --- a/version +++ b/version @@ -1 +1 @@ -v5.10.11 +v6.0.0