added randomness to mobile CPU

This commit is contained in:
piair 2022-02-16 12:42:14 +01:00
parent a87fda6df7
commit e97e4147c3

12
V4.py
View File

@ -51,7 +51,7 @@ g.close
webhookSuccess = Webhook.from_url(SuccessLink, adapter=RequestsWebhookAdapter()) 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, su linux et windows def resource_path(relative_path): #permet de recuperer l'emplacement de chaque fichier, sur linux et windows
try: try:
base_path = sys._MEIPASS base_path = sys._MEIPASS
except Exception: except Exception:
@ -59,8 +59,8 @@ def resource_path(relative_path): #permet de recuperer l'emplacement de chaque f
return path.join(base_path, relative_path) return path.join(base_path, relative_path)
def FirefoxMobile(Headless = Headless): def FirefoxMobile(Headless = Headless, Os = 2):
MOBILE_USER_AGENT = ('Mozilla/5.0 (iPhone; CPU iPhone OS 14_1_2 like Mac OS X)' MOBILE_USER_AGENT = (f'Mozilla/5.0 (iPhone; CPU iPhone OS 14_1_{Os} like Mac OS X)'
'AppleWebKit/603.1.30 (KHTML, like Gecko)' 'AppleWebKit/603.1.30 (KHTML, like Gecko)'
'Version/14.1 Mobile/14E304 Safari/602.1') 'Version/14.1 Mobile/14E304 Safari/602.1')
options = Options() options = Options()
@ -471,7 +471,7 @@ def BingMobileSearch(override = randint(22,25)):
MobileDriver ="si il y a ca dans les logs, c'est que Mobiledriver n'a pas demarrer " MobileDriver ="si il y a ca dans les logs, c'est que Mobiledriver n'a pas demarrer "
try : try :
try : try :
MobileDriver = FirefoxMobile() MobileDriver = FirefoxMobile(Os=hash(_mail)%10) #change device for each account
except Exception as e : except Exception as e :
sleep(30) sleep(30)
LogError('echec de la creation du driver mobile') LogError('echec de la creation du driver mobile')
@ -640,7 +640,7 @@ def LogPoint(account="unknown"): #log des points sur discord
point = search(regex1, driver.page_source)[1].replace(',', '') point = search(regex1, driver.page_source)[1].replace(',', '')
except Exception as e : except Exception as e :
print(e) print(f"LogPoint : {e}")
elem = driver.find_element(By.CSS_SELECTOR, '[title="Microsoft Rewards"]') elem = driver.find_element(By.CSS_SELECTOR, '[title="Microsoft Rewards"]')
elem.click() elem.click()
@ -650,7 +650,7 @@ def LogPoint(account="unknown"): #log des points sur discord
try : try :
point = search("availablePoints\":([\d]+)",driver.page_source)[1] point = search("availablePoints\":([\d]+)",driver.page_source)[1]
except Exception as e : except Exception as e :
LogError(e) LogError(f"LogPoint : {e}")
point = "erreur" point = "erreur"
CustomSleep(uniform(3,20)) CustomSleep(uniform(3,20))