This commit is contained in:
2026-08-31 21:02:52 +02:00
parent a32cc84a90
commit ee07f373ea
3 changed files with 6 additions and 83 deletions
+3 -3
View File
@@ -136,16 +136,16 @@ def get_rating_distribution(
browser = playwright.chromium.launch(**launch)
context = browser.new_context(locale="pl-PL", viewport={"width": 1100, "height": 800})
try:
report(50, "Otwarto Chromium")
report(50, "Trwa łączenie z Google Maps")
page = context.pages[0] if context.pages else context.new_page()
context.add_init_script(
"Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"
)
page.goto(url, wait_until="domcontentloaded", timeout=30_000)
_accept_cookies(page)
report(75, "Załadowano Google Maps")
report(75, "Ładowanie opinii")
_open_reviews(page)
report(90, "Otwarto panel opinii")
report(90, "Obliczanie statystyk")
page.wait_for_timeout(700)
labels = page.locator("[aria-label]").evaluate_all(
"els => els.map(el => el.getAttribute('aria-label')).filter(Boolean)"