Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pw_stealth_enhanced-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pw_stealth_enhanced-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file pw_stealth_enhanced-0.1.0.tar.gz.

File metadata

  • Download URL: pw_stealth_enhanced-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pw_stealth_enhanced-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c575a9c13bd1ee84ec7ed8891aa5868cef075f3dc15cd4f039161c046087c56
MD5 6af49c28b4486e72843026528bf63ffc
BLAKE2b-256 d8526afb0fd7d72bb24a05eee85af7e70a435e0e6f60a6352514113fbb09cf38

See more details on using hashes here.

File details

Details for the file pw_stealth_enhanced-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pw_stealth_enhanced-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f56367f3b41e15005bc592aa7bac3b90a385dc4a087e8606f3fc383b342f908d
MD5 826f9161958efc0291c5cbddc6446c0d
BLAKE2b-256 941202198126db0fbbd25f49da9277157d0fff01c2232709e59132b875bc975e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page