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 <noreply@anthropic.com>
This commit is contained in:
parent
d28c738475
commit
12037dc3f7
2 changed files with 7 additions and 13 deletions
|
|
@ -14,7 +14,7 @@ COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Playwright + Chromium for Booking.com scraper
|
# Playwright + Chromium for Booking.com scraper
|
||||||
RUN playwright install chromium --with-deps
|
RUN playwright install chromium firefox --with-deps
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,19 +220,13 @@ class PlaywrightHotelPageBackend(ScraperBackend):
|
||||||
if not self._pw:
|
if not self._pw:
|
||||||
self._pw = await async_playwright().start()
|
self._pw = await async_playwright().start()
|
||||||
if not self._browser:
|
if not self._browser:
|
||||||
self._browser = await self._pw.chromium.launch(
|
self._browser = await self._pw.firefox.launch(
|
||||||
headless=True,
|
headless=True,
|
||||||
args=[
|
firefox_user_prefs={
|
||||||
'--no-sandbox',
|
# Block images — saves ~75% of proxy bandwidth from cf.bstatic.com.
|
||||||
'--disable-dev-shm-usage',
|
# Firefox pref equivalent of Chrome's --blink-settings=imagesEnabled=false.
|
||||||
'--disable-blink-features=AutomationControlled',
|
'permissions.default.image': 2,
|
||||||
'--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',
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _get_context(self) -> BrowserContext:
|
async def _get_context(self) -> BrowserContext:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue