RYLAIX// UNIVERSE
All field notes

1 min read

Anti-Detect Web Scraping with Camoufox at Scale

Evading advanced browser fingerprinting and canvas entropy detection when monitoring government clinical registries.

  • Python
  • Automation
  • Playwright
  • Web Scraping

Defeating Canvas and Audio Fingerprinting

Government clinical trial registries frequently deploy Cloudflare or custom anti-bot challenges. Standard headless Chromium instances leak automation flags (navigator.webdriver, consistent WebGL renderer hashes, and abnormal audio context curves).

In TrialWatch, we migrated from standard Playwright to Camoufox (a custom Firefox build designed for automation stealth).

from camoufox.async_api import AsyncCamoufox

async def scrape_registry_records(target_url: str) -> list[dict]:
    async with AsyncCamoufox(
        headless=True,
        geoip=True,
        os="windows",
        screen={"min_width": 1920, "min_height": 1080},
    ) as browser:
        page = await browser.new_page()
        await page.goto(target_url, wait_until="networkidle")
        rows = await page.locator(".trial-registry-table tbody tr").all()
        return [await parse_trial_row(row) for row in rows]

Reliable Change Detection

  • Canonical JSON Hashing: trial records are normalized into deterministic schemas before hashing, avoiding false alerts from whitespace changes.
  • Differential Alerts: only structural modifications (protocol status changes, sample size revisions, investigator updates) trigger downstream webhooks.
  • Exponential Jitter Backoff: requests dynamically space out when rate limits or transient errors occur, maintaining a 99.4% long-term scrape success rate.