From 12037dc3f7658434e87793ec7ce851c08dc7c773 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Fri, 10 Jul 2026 09:42:05 +0000 Subject: [PATCH] Switch Playwright to Firefox to evade Booking.com Chromium JA3 fingerprint detection Booking.com detects headless Chromium via TLS ClientHello fingerprint (JA3) and immediately flags the residential proxy IP on first contact. Firefox has a different TLS fingerprint and GREASE extensions that aren't yet flagged. Image blocking via Firefox preference (permissions.default.image=2) replaces the Chrome --blink-settings flag. Dockerfile updated to install both browsers. Co-Authored-By: Claude Sonnet 4.6 --- backend/Dockerfile | 2 +- .../scraper_backends/playwright_hotel_page.py | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index e59aa13..c62474a 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -14,7 +14,7 @@ COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Playwright + Chromium for Booking.com scraper -RUN playwright install chromium --with-deps +RUN playwright install chromium firefox --with-deps COPY . . diff --git a/backend/services/scraper_backends/playwright_hotel_page.py b/backend/services/scraper_backends/playwright_hotel_page.py index 81f27e4..18ea092 100644 --- a/backend/services/scraper_backends/playwright_hotel_page.py +++ b/backend/services/scraper_backends/playwright_hotel_page.py @@ -220,19 +220,13 @@ class PlaywrightHotelPageBackend(ScraperBackend): if not self._pw: self._pw = await async_playwright().start() if not self._browser: - self._browser = await self._pw.chromium.launch( + self._browser = await self._pw.firefox.launch( headless=True, - args=[ - '--no-sandbox', - '--disable-dev-shm-usage', - '--disable-blink-features=AutomationControlled', - '--disable-infobars', - '--disable-extensions', - # Block image loading at the engine level — avoids ~75% of - # proxy bandwidth (cf.bstatic.com CDN) without enabling - # request interception, which breaks proxy auth in Chromium. - '--blink-settings=imagesEnabled=false', - ], + firefox_user_prefs={ + # Block images — saves ~75% of proxy bandwidth from cf.bstatic.com. + # Firefox pref equivalent of Chrome's --blink-settings=imagesEnabled=false. + 'permissions.default.image': 2, + }, ) async def _get_context(self) -> BrowserContext: