Compare commits

...

17 Commits
fix4 ... master

Author SHA1 Message Date
5e5f7f7407 Implement "timezonedates" 2024-10-18 13:03:16 +02:00
0cc42823ff Add new cards (election, dictionary) 2024-10-15 11:51:55 +02:00
56c858fa90 Adding new "explore on Bing" cards 2024-10-08 09:07:01 +02:00
adf91ac8f0 Ignoring MS Security activity (it would be better to detect it before clicking) 2024-10-01 09:03:50 +02:00
2721c76686 Fix LegacyKeyValueFormat warning
"ENV key=value" should be used instead of legacy "ENV key value" format
2024-09-19 11:57:25 +02:00
piair
45ea72a354 Merge remote-tracking branch 'origin/master' 2024-09-14 22:57:48 +02:00
piair
18b35f6f68 adding new custom search cards 2024-09-14 22:57:40 +02:00
c53125479e Check if streak protection expired 2024-08-30 21:48:20 +02:00
df256f2405 Update modules/Tools/update_chrome.py
fix auto update breaking due to path error
2024-08-28 15:48:31 +02:00
31b4d5d7da Actualiser V6.py 2024-07-08 10:00:28 +02:00
574fa45813 Update version 2024-07-05 13:47:08 +02:00
piair
3bb49d1618 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	V6.py
2024-07-05 13:46:04 +02:00
piair
e25334f1bd adding new custom search cards 2024-07-05 13:45:26 +02:00
piair
41312b53b9 c'est bon là 2024-06-18 20:50:55 +02:00
piair
1ac98f14c4 wqMerge branch 'fix4' 2024-06-18 20:38:21 +02:00
piair
f9a21f5b98 Added package tracking card 2024-06-18 16:54:37 +02:00
piair
82161973a9 Added weather carad 2024-06-18 16:38:29 +02:00
4 changed files with 125 additions and 44 deletions

View File

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

163
V6.py
View File

@ -199,42 +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_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:
def check_popups() -> bool:
"""
Ne perdez plus jamais votre série !
Check various annoying popups
"""
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")
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
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() -> 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)
@ -289,8 +314,7 @@ def all_cards():
activity = ""
custom_sleep(1.5)
check_welcome_tour()
check_streak_protection()
check_popups()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
custom_sleep(1.5)
card_list[i].click()
@ -307,8 +331,7 @@ def all_cards():
if "mee-icon-AddMedium" not in card_list[i].get_attribute("innerHTML"):
continue
check_welcome_tour()
check_streak_protection()
check_popups()
driver.execute_script("arguments[0].scrollIntoView();", card_list[i])
card_list[i].click()
@ -424,7 +447,59 @@ def explore_on_bing(activity: str, config: Config):
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', '']} package tracking")
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)]}")
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:
log_error(f"Explore on bing: {activity} not found.")
@ -490,6 +565,8 @@ def try_play(nom="unknown", activity=""):
info(f"Explore on bing: {activity}")
explore_on_bing(activity, config)
custom_sleep(uniform(3, 5))
elif "Optimisez votre sécurité avec Microsoft" in driver.page_source:
info("Still not paying Office 365 ?")
else:
info(f"Nothing obvious to do on page `{nom}`.")
custom_sleep(uniform(3, 5))
@ -501,11 +578,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"),

View File

@ -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]+)"

View File

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