mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-03 23:23:53 +01:00 
			
		
		
		
	useful untested update
This commit is contained in:
		
							
								
								
									
										13
									
								
								V5.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								V5.py
									
									
									
									
									
								
							@@ -224,16 +224,15 @@ def all_cards():
 | 
				
			|||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        printf("no promo card")
 | 
					        printf("no promo card")
 | 
				
			||||||
    if(len(liste) < 10): #most likely an error during loading
 | 
					    if(len(liste) < 10): #most likely an error during loading
 | 
				
			||||||
 | 
					        if "suspendu" in driver.page_source:
 | 
				
			||||||
 | 
					            raise Banned()
 | 
				
			||||||
        driver.refresh()
 | 
					        driver.refresh()
 | 
				
			||||||
        liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
 | 
					        liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
 | 
				
			||||||
        if(len(liste) < 10):
 | 
					        if(len(liste) < 10):
 | 
				
			||||||
            log_error("Less than 10 cards. Most likely an error with login.", driver)
 | 
					            log_error("Less than 10 cards. Most likely an error with login.", driver)
 | 
				
			||||||
            return("PAS ASSEZ DE CARTES")
 | 
					            return("PAS ASSEZ DE CARTES")
 | 
				
			||||||
    if (len(liste) < 20): # most likely not in france
 | 
					    if (len(liste) < 20): # most likely not in france
 | 
				
			||||||
        if not g.norvege : # TODO : rename norvege to not_france or smth like that
 | 
					        printf("moins de 20 cartes. Probablement pas en France.")
 | 
				
			||||||
            g.norvege = True
 | 
					 | 
				
			||||||
            printf("Most likely not in France, thus disabling France specific action")
 | 
					 | 
				
			||||||
            # TODO : check country for fidelity
 | 
					 | 
				
			||||||
    for i in range(len(liste)):
 | 
					    for i in range(len(liste)):
 | 
				
			||||||
        printf(f"carte {i}")
 | 
					        printf(f"carte {i}")
 | 
				
			||||||
        try : 
 | 
					        try : 
 | 
				
			||||||
@@ -250,7 +249,7 @@ def all_cards():
 | 
				
			|||||||
            try : 
 | 
					            try : 
 | 
				
			||||||
                checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
 | 
					                checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
 | 
				
			||||||
            except :
 | 
					            except :
 | 
				
			||||||
                log_error("IndexError", driver)
 | 
					                log_error(f"IndexError, need more log\ncurrent index : {i} \nmaximal index : {len(liste)}", driver)
 | 
				
			||||||
                return("INDEX ERROR")
 | 
					                return("INDEX ERROR")
 | 
				
			||||||
        if checked:
 | 
					        if checked:
 | 
				
			||||||
            custom_sleep(1.5)
 | 
					            custom_sleep(1.5)
 | 
				
			||||||
@@ -709,6 +708,9 @@ def daily_routine(custom = False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        all_cards()
 | 
					        all_cards()
 | 
				
			||||||
 | 
					    except Banned:
 | 
				
			||||||
 | 
					        log_error("banned", driver)
 | 
				
			||||||
 | 
					        return("BANNED")
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -838,6 +840,7 @@ else:
 | 
				
			|||||||
            driver.quit()
 | 
					            driver.quit()
 | 
				
			||||||
            display.stop()
 | 
					            display.stop()
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
 | 
					            log_error(f"Error not catched. Skipping this account. " + format_error(e), driver)
 | 
				
			||||||
            printf(f"Error not catched. Skipping this account. {e}")
 | 
					            printf(f"Error not catched. Skipping this account. {e}")
 | 
				
			||||||
            driver.quit()
 | 
					            driver.quit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user