stable
This commit is contained in:
parent
f098f13242
commit
4b0f33ae26
25
V6.py
25
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()
|
||||
|
|
|
@ -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'] = {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue