refactored log_points

This commit is contained in:
piair 2024-02-28 10:49:27 +01:00
parent 5fe05712bd
commit ced633dd68
2 changed files with 12 additions and 16 deletions

14
V6.py
View File

@ -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:
point = search('availablePoints\":([\d]+)', driver.page_source)[1] points = search('availablePoints\":([\d]+)', driver.page_source)[1]
except Exception as e: except Exception as err:
log_error( log_error(
f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(e)}") f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(err)}")
error("Can't get points.") error(f"Can't get points. {format_error(err)}")
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]

View File

@ -1 +1 @@
v6.8.22 v6.8.23