Compare commits

..

No commits in common. "master" and "fix4" have entirely different histories.
master ... fix4

4 changed files with 44 additions and 125 deletions

View File

@ -1,5 +1,5 @@
FROM python:3.10 FROM python:3.10
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND noninteractive
WORKDIR /app/ WORKDIR /app/
# Initial apt install # Initial apt install

161
V6.py
View File

@ -200,66 +200,41 @@ def do_poll():
def all_cards(): def all_cards():
driver = config.WebDriver.driver driver = config.WebDriver.driver
def check_popups() -> bool: 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)
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
def check_streak_protection() -> bool:
""" """
Check various annoying popups Ne perdez plus jamais votre série !
""" """
def check_welcome_tour() -> bool: try:
if "rewards.bing.com/welcometour" not in driver.current_url: streak_protection_close = driver.find_element(By.ID, "streak-protection-popup-close-cross")
return False streak_protection_activate = driver.find_elements(By.CLASS_NAME, "earningPagePopUpPopUpSelectButton")
streak_protection_activate[0].click()
info("Popup 'Explorer le programme' reçue") info("Popup 'Streak Protection' reçue")
wait_until_visible(By.ID, "welcome-tour", timeout=5, browser=driver)
custom_sleep(1.5) 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 return True
except (exceptions.NoSuchElementException, exceptions.ElementNotInteractableException, IndexError):
def check_streak_protection() -> bool: # les éléments sont présents dans le DOM même quand la popup n'est pas visible apparemment
""" return False
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") driver.get("https://rewards.bing.com")
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver) wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
@ -314,7 +289,8 @@ def all_cards():
activity = "" activity = ""
custom_sleep(1.5) custom_sleep(1.5)
check_popups() check_welcome_tour()
check_streak_protection()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i]) driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
custom_sleep(1.5) custom_sleep(1.5)
card_list[i].click() card_list[i].click()
@ -331,7 +307,8 @@ def all_cards():
if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"): if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"):
continue continue
check_popups() check_welcome_tour()
check_streak_protection()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i]) driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
card_list[i].click() card_list[i].click()
@ -447,59 +424,7 @@ def explore_on_bing(activity: str, config: Config):
search_bing(f"météo {['Paris', 'Nice', 'Marseille', 'Bordeaux', 'Lyon'][randint(0, 4)]}") search_bing(f"météo {['Paris', 'Nice', 'Marseille', 'Bordeaux', 'Lyon'][randint(0, 4)]}")
elif "packagetracking" in activity: elif "packagetracking" in activity:
driver.get("https://www.bing.com/?setmkt=en-US&setlang=en-US") driver.get("https://www.bing.com/?setmkt=en-US&setlang=en-US")
search_bing(f"{['fedex', 'UPS'][randint(0, 1)]} package tracking") search_bing(f"{['fedex', 'UPS', '']} 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)]}")
elif "sports" in activity:
equipes = random.sample([
"Toulon", "toulouse",
"stade Rochelais", "castres",
"clermont", "perpignan",
"aviron bayonnais", "vannes"
], k=2)
search_bing(f"{['score', 'résultats'][randint(0, 1)]} rugby {equipes[0]} {equipes[1]}")
elif "videogames" in activity:
search_bing(random.choice([
"Minecraft", "GTA V",
"Tetris", "PUBG",
"Mario Kart 8",
"Red Dead Redemption II",
"Terraria",
"The Witcher",
"Animal Crossing",
"Pokémon rouge & bleu",
"Super Mario Bros",
"The legend of Zelda BOTW",
"Call of Duty Modern Warfare",
"The Witcher III"
]))
elif "dictionary" in activity:
search_bing(f"définition {config.wordlist.get_word()}")
elif "election" in activity or "timezonedates" in activity:
#! I don't understand the name of "timezonedates" but this seems to be the same activity
state = random.choice([
"Alaska", "Alabama", "Arkansas", "American Samoa", "Arizona", "California", "Colorado",
"Connecticut", "District ", "of Columbia", "Delaware", "Florida", "Georgia", "Guam",
"Hawaii", "Iowa", "Idaho", "Illinois", "Indiana", "Kansas", "Kentucky", "Louisiana",
"Massachusetts", "Maryland", "Maine", "Michigan", "Minnesota", "Missouri", "Mississippi",
"Montana", "North Carolina", "North Dakota", "Nebraska", "New Hampshire", "New Jersey",
"New Mexico", "Nevada", "New York", "Ohio", "Oklahoma", "Oregon", "Pennsylvania",
"Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas",
"Utah", "Virginia", "Virgin Islands", "Vermont", "Washington", "Wisconsin",
"West Virginia", "Wyoming"
])
search_bing(f"governor candidates {state} 2024")
else: else:
log_error(f"Explore on bing: {activity} not found.") log_error(f"Explore on bing: {activity} not found.")
@ -565,8 +490,6 @@ def try_play(nom="unknown", activity=""):
info(f"Explore on bing: {activity}") info(f"Explore on bing: {activity}")
explore_on_bing(activity, config) explore_on_bing(activity, config)
custom_sleep(uniform(3, 5)) custom_sleep(uniform(3, 5))
elif "Optimisez votre sécurité avec Microsoft" in driver.page_source:
info("Still not paying Office 365 ?")
else: else:
info(f"Nothing obvious to do on page `{nom}`.") info(f"Nothing obvious to do on page `{nom}`.")
custom_sleep(uniform(3, 5)) custom_sleep(uniform(3, 5))
@ -578,15 +501,11 @@ def login_part_1():
info("Starting part 1 of login") info("Starting part 1 of login")
driver = config.WebDriver.driver driver = config.WebDriver.driver
driver.get("https://login.live.com") driver.get("https://login.live.com")
try: wait_until_visible(By.ID, "i0116", browser=driver)
wait_until_visible(By.ID, "i0116", browser=driver) send_wait_and_confirm(
send_wait_and_confirm( driver.find_element(By.ID, "i0116"),
driver.find_element(By.ID, "i0116"), config.UserCredentials.get_mail()
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) wait_until_visible(By.ID, "i0118", browser=driver)
send_wait_and_confirm( send_wait_and_confirm(
driver.find_element(By.ID, "i0118"), driver.find_element(By.ID, "i0118"),

View File

@ -5,7 +5,7 @@ import subprocess
from logger import critical, info, error from logger import critical, info, error
errorMessage = subprocess.run(['python3', '/app/MsRewards-Reborn/modules/Tools/generate_error.py'], check=False, stdout=subprocess.PIPE, errorMessage = subprocess.run(['python3', 'generate_error.py'], check=False, stdout=subprocess.PIPE,
stderr=subprocess.PIPE).stderr.decode("utf-8") stderr=subprocess.PIPE).stderr.decode("utf-8")
versionPattern = "This version of ChromeDriver only supports Chrome version ([0-9]+)" versionPattern = "This version of ChromeDriver only supports Chrome version ([0-9]+)"

View File

@ -1 +1 @@
v6.8.65 v6.8.57