Rollback Point - facebok E-Mail Code geht wieder

Dieser Commit ist enthalten in:
Claude Project Manager
2025-10-11 23:19:27 +02:00
Ursprung 877cfdaf8b
Commit 9c1d7d8a8f
2 geänderte Dateien mit 40 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -643,37 +643,56 @@ class FacebookRegistration:
def _check_needs_verification(self) -> bool: def _check_needs_verification(self) -> bool:
""" """
Prüft ob eine E-Mail-Verifikation erforderlich ist. Prüft ob eine E-Mail-Verifikation erforderlich ist.
Wartet auf Navigation zur Verifikationsseite falls nötig.
Returns: Returns:
bool: True wenn Verifikation erforderlich bool: True wenn Verifikation erforderlich
""" """
try: try:
# Warte kurz # Warte auf Page-Load nach Submit
self.automation.human_behavior.random_delay(2.0, 3.0) self.automation.human_behavior.wait_for_page_load(multiplier=1.5)
# Prüfe URL # Warte zusätzlich auf mögliche Navigation zur Verifikationsseite
current_url = self.automation.browser.page.url # Versuche bis zu 10 Sekunden lang die URL zu prüfen
if "confirmemail" in current_url or "confirm" in current_url: max_wait_time = 10 # Sekunden
logger.info("E-Mail-Verifikation erforderlich (URL-Check)") check_interval = 0.5 # Sekunden
return True attempts = int(max_wait_time / check_interval)
# Prüfe auf Verifikations-Input for attempt in range(attempts):
if self.automation.browser.is_element_visible(self.selectors.VERIFICATION_CODE_INPUT, timeout=2000): current_url = self.automation.browser.page.url
logger.info("E-Mail-Verifikation erforderlich (Input-Field)") logger.debug(f"Prüfe URL (Versuch {attempt + 1}/{attempts}): {current_url}")
return True
# Prüfe URL auf Verifikations-Pattern
# Prüfe auf Verifikations-Text if "confirmemail" in current_url or "confirm" in current_url:
logger.info(f"E-Mail-Verifikation erforderlich (URL-Check): {current_url}")
return True
# Prüfe auf Verifikations-Input
if self.automation.browser.is_element_visible(self.selectors.VERIFICATION_CODE_INPUT, timeout=500):
logger.info("E-Mail-Verifikation erforderlich (Input-Field gefunden)")
return True
# Prüfe auf Erfolgs-Indikatoren (dann keine Verifikation nötig)
for indicator in self.selectors.SUCCESS_INDICATORS:
if self.automation.browser.is_element_visible(indicator, timeout=500):
logger.info(f"Keine Verifikation nötig (Erfolgs-Indikator gefunden: {indicator})")
return False
# Kurze Pause vor nächstem Versuch
time.sleep(check_interval)
# Nach max_wait_time: Finale Prüfung mit Keywords
page_content = self.automation.browser.page.content().lower() page_content = self.automation.browser.page.content().lower()
verification_keywords = ["bestätigungscode", "verification code", "confirm email", "code eingeben"] verification_keywords = ["bestätigungscode", "verification code", "confirm email", "code eingeben"]
for keyword in verification_keywords: for keyword in verification_keywords:
if keyword in page_content: if keyword in page_content:
logger.info(f"E-Mail-Verifikation erforderlich (Keyword: {keyword})") logger.info(f"E-Mail-Verifikation erforderlich (Keyword: {keyword})")
return True return True
logger.info("Keine E-Mail-Verifikation erforderlich") logger.info("Keine E-Mail-Verifikation erforderlich")
return False return False
except Exception as e: except Exception as e:
logger.error(f"Fehler bei Verifikations-Check: {e}") logger.error(f"Fehler bei Verifikations-Check: {e}")
return False return False

Datei anzeigen

@ -578,6 +578,8 @@ class EmailHandler:
r"[^\d](\d{6})[^\d]" # 6-stellige Zahl umgeben von Nicht-Ziffern r"[^\d](\d{6})[^\d]" # 6-stellige Zahl umgeben von Nicht-Ziffern
], ],
"facebook": [ "facebook": [
r"FB-(\d{5})", # Format: FB-24518 (häufigstes Format)
r"Bestätigungscode lautet (\d{5})", # "Dein Bestätigungscode lautet 24518"
r"Dein Code ist (\d{5})", r"Dein Code ist (\d{5})",
r"Your code is (\d{5})", r"Your code is (\d{5})",
r"Bestätigungscode: (\d{5})", r"Bestätigungscode: (\d{5})",