mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-10-31 14:23:53 +01:00 
			
		
		
		
	refactored log_points
This commit is contained in:
		
							
								
								
									
										14
									
								
								V6.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								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: | ||||||
|             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] | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user