mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-03 23:23:53 +01:00 
			
		
		
		
	Compare commits
	
		
			22 Commits
		
	
	
		
			debug_logi
			...
			45ea72a354
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					45ea72a354 | ||
| 
						 | 
					18b35f6f68 | ||
| 
						 | 
					c53125479e | ||
| 
						 | 
					df256f2405 | ||
| 
						 | 
					31b4d5d7da | ||
| 
						 | 
					574fa45813 | ||
| 
						 | 
					3bb49d1618 | ||
| 
						 | 
					e25334f1bd | ||
| 
						 | 
					41312b53b9 | ||
| 
						 | 
					1ac98f14c4 | ||
| 
						 | 
					a197d44768 | ||
| 
						 | 
					f9a21f5b98 | ||
| 
						 | 
					82161973a9 | ||
| 
						 | 
					c7e110787b | ||
| 
						 | 
					1db1de9606 | ||
| 
						 | 
					10d75f9d78 | ||
| 
						 | 
					87fb791436 | ||
| 
						 | 
					6995bde8a6 | ||
| 
						 | 
					92069a013e | ||
| 
						 | 
					906d3e7822 | ||
| 
						 | 
					778adc67d2 | ||
| 
						 | 
					402b8cd3ef | 
							
								
								
									
										143
									
								
								V6.py
									
									
									
									
									
								
							
							
						
						
									
										143
									
								
								V6.py
									
									
									
									
									
								
							@@ -199,26 +199,67 @@ def do_poll():
 | 
			
		||||
# Find each playable card and tries to click on it to earn points
 | 
			
		||||
def all_cards():
 | 
			
		||||
    driver = config.WebDriver.driver
 | 
			
		||||
    
 | 
			
		||||
    def check_popups() -> bool:
 | 
			
		||||
        """
 | 
			
		||||
        Check various annoying popups
 | 
			
		||||
        """
 | 
			
		||||
        def check_welcome_tour() -> bool:
 | 
			
		||||
            if "rewards.bing.com/welcometour" not in driver.current_url:
 | 
			
		||||
                return False
 | 
			
		||||
 | 
			
		||||
    def check_welcome_tour() -> bool:
 | 
			
		||||
        if "rewards.bing.com/welcometour" not in driver.current_url:
 | 
			
		||||
            return False
 | 
			
		||||
            info("Popup 'Explorer le programme' reçue")
 | 
			
		||||
            wait_until_visible(By.ID, "welcome-tour", timeout=5, browser=driver)
 | 
			
		||||
            custom_sleep(1.5)
 | 
			
		||||
 | 
			
		||||
        info("Popup 'Explorer le programme' reçue")
 | 
			
		||||
        wait_until_visible(By.ID, "welcome-tour", timeout=5, browser=driver)
 | 
			
		||||
        custom_sleep(1.5)
 | 
			
		||||
            welcome_tour = driver.find_element(By.ID, "welcome-tour")
 | 
			
		||||
            interest_button_box = welcome_tour.find_element(By.CLASS_NAME, "interest-buttons")
 | 
			
		||||
            interests = interest_button_box.find_elements(By.CLASS_NAME, "ng-binding")
 | 
			
		||||
            debug("Got the following interests: " + str(interests))
 | 
			
		||||
            random.choice(interests).click()  # Choose interest
 | 
			
		||||
            custom_sleep(1.5)
 | 
			
		||||
 | 
			
		||||
        welcome_tour = driver.find_element(By.ID, "welcome-tour")
 | 
			
		||||
        interest_button_box = welcome_tour.find_element(By.CLASS_NAME, "interest-buttons")
 | 
			
		||||
        interests = interest_button_box.find_elements(By.CLASS_NAME, "ng-binding")
 | 
			
		||||
        debug("Got the following interests: " + str(interests))
 | 
			
		||||
        random.choice(interests).click()  # Choose interest
 | 
			
		||||
        custom_sleep(1.5)
 | 
			
		||||
            claim_button = welcome_tour.find_element(By.ID, "claim-button")
 | 
			
		||||
            claim_button.click()  # submit
 | 
			
		||||
            custom_sleep(1.5)
 | 
			
		||||
            return True
 | 
			
		||||
 | 
			
		||||
        claim_button = welcome_tour.find_element(By.ID, "claim-button")
 | 
			
		||||
        claim_button.click()  # submit
 | 
			
		||||
        custom_sleep(1.5)
 | 
			
		||||
        return True
 | 
			
		||||
        def check_streak_protection() -> bool:
 | 
			
		||||
            """
 | 
			
		||||
            Ne perdez plus jamais votre série !
 | 
			
		||||
            """
 | 
			
		||||
            try:
 | 
			
		||||
                streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross")
 | 
			
		||||
                streak_protection_activate = driver.find_elements(By.CLASS_NAME, "earningPagePopUpPopUpSelectButton")
 | 
			
		||||
                streak_protection_activate[0].click()
 | 
			
		||||
                info("Popup 'Streak Protection' reçue")
 | 
			
		||||
                custom_sleep(1.5)
 | 
			
		||||
 | 
			
		||||
                return True
 | 
			
		||||
            except (exceptions.NoSuchElementException, exceptions.ElementNotInteractableException, IndexError):
 | 
			
		||||
                # les éléments sont présents dans le DOM même quand la popup n'est pas visible apparemment
 | 
			
		||||
                return False
 | 
			
		||||
 | 
			
		||||
        def check_streak_protection_expired() -> bool:
 | 
			
		||||
            """
 | 
			
		||||
            Non, vous avez utilisé tous vos jours de protection contre les séries !
 | 
			
		||||
            """
 | 
			
		||||
            try:
 | 
			
		||||
                streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross")
 | 
			
		||||
                ok_sad_button = driver.find_elements(By.CLASS_NAME, "dashboardPopUpPopUpSelectButton")
 | 
			
		||||
                ok_sad_button[0].click()
 | 
			
		||||
                info("Popup 'Streak Protection fully used' reçue")
 | 
			
		||||
                custom_sleep(1.5)
 | 
			
		||||
 | 
			
		||||
                return True
 | 
			
		||||
            except (exceptions.NoSuchElementException, exceptions.ElementNotInteractableException, IndexError):
 | 
			
		||||
                return False
 | 
			
		||||
 | 
			
		||||
        return (
 | 
			
		||||
            check_welcome_tour()
 | 
			
		||||
            or check_streak_protection()
 | 
			
		||||
            or check_streak_protection_expired()
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    driver.get("https://rewards.bing.com")
 | 
			
		||||
    wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
 | 
			
		||||
@@ -273,7 +314,7 @@ def all_cards():
 | 
			
		||||
            activity = ""
 | 
			
		||||
 | 
			
		||||
        custom_sleep(1.5)
 | 
			
		||||
        check_welcome_tour()
 | 
			
		||||
        check_popups()
 | 
			
		||||
        driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
 | 
			
		||||
        custom_sleep(1.5)
 | 
			
		||||
        card_list[i].click()
 | 
			
		||||
@@ -290,7 +331,7 @@ def all_cards():
 | 
			
		||||
            if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"):
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
            check_welcome_tour()
 | 
			
		||||
            check_popups()
 | 
			
		||||
            driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
 | 
			
		||||
            card_list[i].click()
 | 
			
		||||
 | 
			
		||||
@@ -370,6 +411,57 @@ def explore_on_bing(activity: str, config: Config):
 | 
			
		||||
        search_bing(f"traduction {config.wordlist.get_word()} en anglais")
 | 
			
		||||
    elif "map" in activity:
 | 
			
		||||
        search_bing(f"{['Paris', 'Nice', 'Marseille', 'Bordeaux', 'Lyon'][randint(0, 4)]} carte")
 | 
			
		||||
    elif "restaurant" in activity:
 | 
			
		||||
        search_bing(random.choice([
 | 
			
		||||
            "restaurant à proximité",
 | 
			
		||||
            "restaurant pas loin",
 | 
			
		||||
            "manger dans le coin"
 | 
			
		||||
        ]))
 | 
			
		||||
    elif "recipe" in activity:
 | 
			
		||||
        search_bing("recette de " + random.choice([
 | 
			
		||||
            "cake aux olives",
 | 
			
		||||
            "tarte tatin",
 | 
			
		||||
            "Kouign Amann",
 | 
			
		||||
            "poulet au Curry",
 | 
			
		||||
            "lasagnes aux épinards et ricotta",
 | 
			
		||||
            "Boeuf Bourguignon",
 | 
			
		||||
            "dessert",
 | 
			
		||||
            "gateau au chocolat",
 | 
			
		||||
            "crêpe sucrée"
 | 
			
		||||
        ]))  # Merci llama pour les idées
 | 
			
		||||
    elif "currency" in activity:
 | 
			
		||||
        currencies = [
 | 
			
		||||
            "euros",
 | 
			
		||||
            "dollars canadiens",
 | 
			
		||||
            "dollars",
 | 
			
		||||
            "livres",
 | 
			
		||||
            "francs suisses",
 | 
			
		||||
            "roubles",
 | 
			
		||||
            "pesos",
 | 
			
		||||
            "bitcoin",
 | 
			
		||||
            "anciens francs"
 | 
			
		||||
        ]
 | 
			
		||||
        chosen = random.sample(currencies, k=2)
 | 
			
		||||
        search_bing(f"convertir {random.randint(2, 120)} {chosen[0]} en {chosen[1]}")
 | 
			
		||||
    elif "weather" in activity:
 | 
			
		||||
        search_bing(f"météo {['Paris', 'Nice', 'Marseille', 'Bordeaux', 'Lyon'][randint(0, 4)]}")
 | 
			
		||||
    elif "packagetracking" in activity:
 | 
			
		||||
        driver.get("https://www.bing.com/?setmkt=en-US&setlang=en-US")
 | 
			
		||||
        search_bing(f"{['fedex', 'UPS'][randint(0, 1)]} package tracking")
 | 
			
		||||
    elif "hotel" in activity:
 | 
			
		||||
        search_bing(f" {['Paris', 'Nice', 'Marseille', 'Bordeaux', 'Lyon'][randint(0, 4)]}")
 | 
			
		||||
    elif "health" in activity:
 | 
			
		||||
        search_bing(f"{['toux', 'douleur dos', 'nez qui coule', 'mal au genoux', 'otite'][randint(0, 4)]}")
 | 
			
		||||
    elif "news" in activity:
 | 
			
		||||
        search_bing(["actualités", "news"][randint(0, 1)])
 | 
			
		||||
    elif "jobs" in activity:
 | 
			
		||||
        search_bing("jobs")
 | 
			
		||||
    elif "realestate" in activity:
 | 
			
		||||
        search_bing(f"appartement à louer {['Paris', 'Nice', 'Marseille', 'Bordeaux', 'Lyon'][randint(0, 4)]}")
 | 
			
		||||
    elif "financemarket" in activity:
 | 
			
		||||
        search_bing(
 | 
			
		||||
            f"cours action {['AIR LIQUIDE', 'Airbus', 'BNP Paribas', 'Michelin', 'Stellantis', 'Vinci'][randint(0, 5)]}")
 | 
			
		||||
 | 
			
		||||
    else:
 | 
			
		||||
        log_error(f"Explore on bing: {activity} not found.")
 | 
			
		||||
 | 
			
		||||
@@ -446,11 +538,15 @@ def login_part_1():
 | 
			
		||||
    info("Starting part 1 of login")
 | 
			
		||||
    driver = config.WebDriver.driver
 | 
			
		||||
    driver.get("https://login.live.com")
 | 
			
		||||
    wait_until_visible(By.ID, "i0116", browser=driver)
 | 
			
		||||
    send_wait_and_confirm(
 | 
			
		||||
        driver.find_element(By.ID, "i0116"),
 | 
			
		||||
        config.UserCredentials.get_mail()
 | 
			
		||||
    )
 | 
			
		||||
    try:
 | 
			
		||||
        wait_until_visible(By.ID, "i0116", browser=driver)
 | 
			
		||||
        send_wait_and_confirm(
 | 
			
		||||
            driver.find_element(By.ID, "i0116"),
 | 
			
		||||
            config.UserCredentials.get_mail()
 | 
			
		||||
        )
 | 
			
		||||
    except exceptions.NoSuchElementException:
 | 
			
		||||
        info("Unable to find mail input for login, might be semi-logged-in")
 | 
			
		||||
 | 
			
		||||
    wait_until_visible(By.ID, "i0118", browser=driver)
 | 
			
		||||
    send_wait_and_confirm(
 | 
			
		||||
        driver.find_element(By.ID, "i0118"),
 | 
			
		||||
@@ -847,6 +943,7 @@ def default_start():
 | 
			
		||||
        try:
 | 
			
		||||
            config.WebDriver.set_pc_driver(create_driver())
 | 
			
		||||
        except:
 | 
			
		||||
            info("Could not configure driver. Trying to update it.")
 | 
			
		||||
            subprocess.Popen(["python3", "/app/MsRewards-Reborn/modules/Tools/update_chrome.py"])
 | 
			
		||||
            config.WebDriver.set_pc_driver(create_driver())
 | 
			
		||||
        config.WebDriver.switch_to_driver("PC")
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import subprocess
 | 
			
		||||
 | 
			
		||||
from logger import critical, info, error
 | 
			
		||||
 | 
			
		||||
errorMessage = subprocess.run(['python3', 'generate_error.py'], check=False, stdout=subprocess.PIPE,
 | 
			
		||||
errorMessage = subprocess.run(['python3', '/app/MsRewards-Reborn/modules/Tools/generate_error.py'], check=False, stdout=subprocess.PIPE,
 | 
			
		||||
                              stderr=subprocess.PIPE).stderr.decode("utf-8")
 | 
			
		||||
 | 
			
		||||
versionPattern = "This version of ChromeDriver only supports Chrome version ([0-9]+)"
 | 
			
		||||
@@ -15,6 +15,8 @@ try:
 | 
			
		||||
except Exception as e:
 | 
			
		||||
    critical("Can't get version number from error")
 | 
			
		||||
    error(e)
 | 
			
		||||
    info("error message")
 | 
			
		||||
    info(errorMessage)
 | 
			
		||||
    exit(0)
 | 
			
		||||
 | 
			
		||||
info(f"Needed version : '{versionN}'")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user