Skip to main content

Stealth & Anti-detection

Pry's anti-detection stack is its core competitive moat — a multi-layered system that keeps scrapers looking like real users. The stealth module is licensed under BSL 1.1 (Business Source License): free for personal, non-production, academic, and non-commercial use; a commercial license is required for production use. It converts to MIT on 2029-01-01.

The 10-tier fallback chain

When a request hits POST /v1/ultimate-scrape (or any scrape that enables bypass), Pry walks a fallback chain and returns the first successful result, reporting which method was used.

TierMethodPurpose
1Direct HTTPRotating user agents, browser-like headers
2cloudscraperPython-native Cloudflare JS challenge solving
3FlareSolverrHeadless Chrome Cloudflare/WAF bypass (Docker sidecar)
4undetected-chromedriverModified Chrome with no automation flags
5PlaywrightFull browser with human behavior (mouse, scroll, timing)
6Googlebot UASearch-engine crawl mimic
7Tor proxyAnonymous routing via SOCKS5
8Archive.org / Wayback MachineCached version fallback
9Google CacheCached snapshot
10TextiseText-only version

Block detection and adaptive strategy rotation decide when to escalate:

  • POST /v1/detect-block — detect the protection vendor (Cloudflare/DataDome/etc.) and confidence
  • adaptive.py — rotates strategies automatically based on detected blocking

Stealth engine

stealth_engine.py injects 6 JavaScript scripts into every browser context to hide automation signals:

ScriptWhat it does
webdriver_hide.jsRemoves the navigator.webdriver automation flag
canvas_noise.jsAdds tiny noise to canvas fingerprinting
webgl_noise.jsAdds noise to WebGL fingerprinting
audio_noise.jsAdds noise to AudioContext fingerprinting
human_mouse.jsGenerates human-like mouse movement paths
human_type.jsTypes with human-like speed and errors

Enable/disable via the stealth env vars:

VariableDefaultMeaning
PRY_STEALTH_ENABLEDtrueMaster switch
PRY_RANDOM_USER_AGENTtrueRotate user agents
PRY_WEBDRIVER_OVERRIDEtrueHide navigator.webdriver
PRY_CANVAS_NOISEtrueCanvas fingerprint noise
PRY_WEBRTC_DISABLEtrueDisable WebRTC IP leaks
PRY_GEOLOCATION_SPOOFtrueSpoof geolocation

TLS fingerprint randomization

tls_fingerprint.py randomizes the TLS fingerprint (JA3/JA4) per request. Modern bot detection inspects the TLS handshake, not just headers — a unique fingerprint per request prevents transport-level identification.

cookie_warmer.py pre-ages cookies so sessions carry realistic trust signals instead of appearing freshly created. Warmed cookie sessions are persisted to disk and listed via GET /v1/cookies/sessions and GET /v1/sessions.

Behavioral biometrics

behavioral_biometrics.py (v2) simulates real human imperfection: hesitation, scroll-back, mouse drift, reading time. Modern anti-bot systems detect "too perfect" behavior, so Pry deliberately adds:

  • Bezier-curve mouse paths with random control points
  • Speed variation (fast in the middle, slow at endpoints)
  • Random delays between actions (PRY_MIN_DELAY_MS / PRY_MAX_DELAY_MS)
  • Crypto-grade entropy (random.SystemRandom) so behavior is not predictable

Camoufox integration

For the hardest targets, camoufox_integration.py drives Camoufox — a Firefox fork patched at the source level to defeat fingerprinting. It ships preset browser profiles (e.g. a Windows/Chrome-mimicking config) and falls back gracefully if the camoufox package isn't installed.

Browser pool & pre-warming

browser_pool.py manages Playwright browsers with pre-warming: browser contexts are created ahead of time and kept warm, so each request gets a fresh, fully-initialized browser instantly (no cold-start latency).

Proxy rotation

network.py + webshare_proxy.py provide:

  • SOCKS5 proxy support
  • Webshare residential proxy pool with rotation (provider tag webshare)
  • Tor routing (tier documented, requires the tor compose profile and aiohttp-socks)

Configure via PRY_PROXY_URL, PRY_PROXY_TYPE, WEBSHARE_PROXY_LIST, and PRY_TOR_ENABLED — see Configuration.

License note

The following files are BSL 1.1 (the stealth module):

ultimate_scraper.py, stealth_engine.py, stealth_scripts/*.js,
camoufox_integration.py, tls_fingerprint.py, cookie_warmer.py,
behavioral_biometrics.py, adaptive.py, browser_pool.py, network.py,
captcha_solver.py, shadow_dom.py, lazy_load.py, signup_automator.py,
auth_connector.py

Everything else (core scraping, API, utilities, SDK) is MIT. See Pricing & Monetization for the licensing summary and how to get a commercial license.

Next steps