Skip to main content

pw-stealth-enhanced

Enhanced stealth/anti-fingerprinting for Playwright. Successor to the deprecated playwright-stealth.

Why?

playwright-stealth has been unmaintained since 2025 and doesn't handle modern bot detection techniques. This package provides comprehensive fingerprint protection with:

  • navigator.webdriver masking (most critical for bot detection)
  • Canvas fingerprint noise injection
  • WebGL vendor/renderer spoofing
  • Audio fingerprint perturbation
  • Font enumeration spoofing
  • permissions.query patching
  • User-Agent / viewport rotation pools
  • Locale / timezone spoofing

Install

pip install pw-stealth-enhanced

Requires Playwright >= 1.40.

Quick Start

import asyncio
from playwright.async_api import async_playwright
from pw_stealth_enhanced import apply_stealth

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        context = await browser.new_context()

        # Apply stealth patches
        await apply_stealth(context, locale="ja-JP", timezone_id="Asia/Tokyo")

        page = await context.new_page()
        await page.goto("https://example.com")
        # ... your scraping logic ...

asyncio.run(main())

Configuration

from pw_stealth_enhanced import apply_stealth, StealthConfig

config = StealthConfig(
    rotate_ua=True,           # Random UA on each context
    rotate_viewport=True,     # Random viewport size
    locale="en-US",
    timezone_id="America/New_York",
)
await apply_stealth(context, config=config)

API

apply_stealth(context, *, config=None, user_agent=None, viewport=None, locale=None, timezone_id=None)

Apply stealth patches to an existing BrowserContext.

create_context_with_stealth(browser, *, config=None, **kwargs)

Create a new BrowserContext with stealth pre-applied.

StealthConfig

Configuration object with rotation pools for UA and viewport.

Verification

Test your stealth setup at:

License

MIT

Metadata

Release files for pw-stealth-enhanced 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pw-stealth-enhanced 0.1.0
File Size Uploaded
pw_stealth_enhanced-0.1.0.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pw-stealth-enhanced 0.1.0
File Interpreter ABI Platform
pw_stealth_enhanced-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / pw_stealth_enhanced-0.1.0.tar.gz

Download URL pw_stealth_enhanced-0.1.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6c575a9c13bd1ee84ec7ed8891aa5868cef075f3dc15cd4f039161c046087c56
BLAKE2b-256 checksum
How to use checksums
d8526afb0fd7d72bb24a05eee85af7e70a435e0e6f60a6352514113fbb09cf38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pw_stealth_enhanced-0.1.0-py3-none-any.whl

Download URL pw_stealth_enhanced-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f56367f3b41e15005bc592aa7bac3b90a385dc4a087e8606f3fc383b342f908d
BLAKE2b-256 checksum
How to use checksums
941202198126db0fbbd25f49da9277157d0fff01c2232709e59132b875bc975e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page