forked from piair/MsRewards-Reborn
refactored log_points
This commit is contained in:
parent
5fe05712bd
commit
ced633dd68
26
V6.py
26
V6.py
@ -457,26 +457,22 @@ def bing_pc_search(override=randint(35, 40)):
|
|||||||
log_error(f"clear la barre de recherche - {format_error(e)}") # what is this message ??? todo
|
log_error(f"clear la barre de recherche - {format_error(e)}") # what is this message ??? todo
|
||||||
|
|
||||||
|
|
||||||
# Sends points to database, discord and whatever service you want
|
# Sends current account's points to database
|
||||||
# todo: refactor
|
|
||||||
def log_points():
|
def log_points():
|
||||||
driver = config.WebDriver.driver
|
driver = config.WebDriver.driver
|
||||||
account = config.UserCredentials.get_mail()
|
account = config.UserCredentials.get_mail()
|
||||||
|
|
||||||
def get_points():
|
driver.get("https://rewards.bing.com")
|
||||||
driver.get("https://rewards.bing.com")
|
custom_sleep(1)
|
||||||
custom_sleep(1)
|
wait_until_visible(By.CSS_SELECTOR, 'span[mee-element-ready="$ctrl.loadCounterAnimation()"]', browser=driver)
|
||||||
wait_until_visible(By.CSS_SELECTOR, 'span[mee-element-ready="$ctrl.loadCounterAnimation()"]', browser=driver)
|
try:
|
||||||
try:
|
points = search('availablePoints\":([\d]+)', driver.page_source)[1]
|
||||||
point = search('availablePoints\":([\d]+)', driver.page_source)[1]
|
except Exception as err:
|
||||||
except Exception as e:
|
log_error(
|
||||||
log_error(
|
f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(err)}")
|
||||||
f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(e)}")
|
error(f"Can't get points. {format_error(err)}")
|
||||||
error("Can't get points.")
|
return -1
|
||||||
return -1
|
|
||||||
return point
|
|
||||||
|
|
||||||
points = get_points()
|
|
||||||
custom_sleep(uniform(3, 20))
|
custom_sleep(uniform(3, 20))
|
||||||
account_name = account.split("@")[0]
|
account_name = account.split("@")[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user