fix: Google Consent-Seite für DE-IPs (DSGVO) wegklicken
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
7adc9529b7
commit
bf1d0eb071
1 changed files with 18 additions and 1 deletions
|
|
@ -62,7 +62,24 @@ def scrape_google_flights(von, nach, tage=30):
|
||||||
sb.open(url)
|
sb.open(url)
|
||||||
sb.sleep(6)
|
sb.sleep(6)
|
||||||
|
|
||||||
# Cookie-Banner wegklicken
|
# Google Consent-Seite (DSGVO, DE-IPs) wegklicken
|
||||||
|
if "consent.google" in sb.get_current_url() or "Bevor Sie" in sb.get_title():
|
||||||
|
for selector in [
|
||||||
|
'button[aria-label*="Alle akzeptieren"]',
|
||||||
|
'button[aria-label*="Accept all"]',
|
||||||
|
'form[action*="save"] button',
|
||||||
|
'button.tHlp8d',
|
||||||
|
'div#introAgreeButton',
|
||||||
|
'button:contains("Alle akzeptieren")',
|
||||||
|
]:
|
||||||
|
try:
|
||||||
|
sb.click(selector, timeout=3)
|
||||||
|
sb.sleep(3)
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Cookie-Banner auf der Flights-Seite
|
||||||
for selector in ['button[aria-label*="Alle"]', 'button[aria-label*="Accept"]',
|
for selector in ['button[aria-label*="Alle"]', 'button[aria-label*="Accept"]',
|
||||||
'button[aria-label*="Zustimmen"]', 'button.VfPpkd-LgbsSe']:
|
'button[aria-label*="Zustimmen"]', 'button.VfPpkd-LgbsSe']:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue