From 262d388b996f687981f11135a845128cc16e9bbf Mon Sep 17 00:00:00 2001 From: Federico <85809106+feder-cr@users.noreply.github.com> Date: Sat, 6 Jun 2026 07:51:46 +0200 Subject: [PATCH] Update README.md --- README.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/README.md b/README.md index 57e4f2e..01dbc36 100644 --- a/README.md +++ b/README.md @@ -186,27 +186,6 @@ invisible_playwright version # wrapper and binary versions invisible_playwright clear-cache # remove all cached binaries ``` -## Public API for downstream integrations - -When you're building a third-party fetcher (a Crawlee `BrowserPool` subclass, a changedetection.io plugin, an agno toolkit, a Skyvern backend) and need to own the browser lifecycle yourself, use the public helpers instead of `InvisiblePlaywright`: - -```python -from playwright.async_api import async_playwright -from invisible_playwright import ensure_binary, get_default_stealth_prefs - -async with async_playwright() as p: - browser = await p.firefox.launch( - executable_path=str(ensure_binary()), - firefox_user_prefs=get_default_stealth_prefs(seed=42), - ) -``` - -`get_default_stealth_prefs(seed, *, pin, locale, timezone, extra_prefs, humanize, virtual_display)` returns the same dict that `InvisiblePlaywright(seed=..., locale=..., ...)` would inject. Same deterministic seed semantics, same humanize toggle, same `extra_prefs` overlay. `ensure_binary()` downloads the patched Firefox on first call and returns its absolute path. - -> Important: pass `headless=False` to `firefox.launch()` and manage display hiding yourself (Xvfb on Linux, hidden desktop on Windows). Passing `headless=True` directly puts Firefox in true headless mode and skips the real rendering pipeline, which breaks canvas / audio / WebGL fingerprint coherence. The `InvisiblePlaywright` context manager does this translation automatically; the public helpers leave it to the caller. - -For everyday Python usage the `InvisiblePlaywright` context manager is still the recommended entry point. - ## Related projects invisible_playwright takes a different angle than the major Firefox-hardening projects but stands on their shoulders: