Skip to main content

pyppeteer-stealth

Transplanted from puppeteer-extra-plugin-stealth, Not perfect.

Install

$ pip install pyppeteer_stealth

Usage

import asyncio
from pyppeteer import launch
from pyppeteer_stealth import stealth

async def main():
    browser = await launch(headless=True)
    page = await browser.newPage()

    await stealth(page)  # <-- Here

    await page.goto("https://bot.sannysoft.com/")
    await browser.close()
asyncio.get_event_loop().run_until_complete(main())

Args

stealth(
  page: Page,
  run_on_insecure_origins: bool = False,
  languages: [str] = ["en-US", "en"],
  vendor: str = "Google Inc."
  user_agent: str = None,
  locale: str = "en-US,en",
  mask_linux: bool = True,
  webgl_vendor: str = "Intel Inc.",
  renderer: str = "Intel Iris OpenGL Engine",
  disabled_evasions: list = [],
)

List of valid evasion names to pass into disabled_evasions:

['chrome_app',
 'chrome_runtime',
 'iframe_content_window',
 'media_codecs',
 'sourceurl',
 'navigator_hardware_concurrency',
 'navigator_languages',
 'navigator_permissions',
 'navigator_plugins',
 'navigator_vendor',
 'navigator_webdriver',
 'user_agent_override',
 'webgl_vendor',
 'window_outerdimensions']

Test results

Pyppeteer without stealth

headless
headful

Pyppeteer with stealth

headless
headful

Release files for pyppeteer-stealth 2.7.4

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

Source distribution (sdist)

Source distribution for pyppeteer-stealth 2.7.4
File Size Uploaded
pyppeteer_stealth-2.7.4.tar.gz 21.5 kB Details

Release files / pyppeteer_stealth-2.7.4.tar.gz

Download URL pyppeteer_stealth-2.7.4.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cd1d040f23f17c76260a44c7f295e238174a41cc28213ccf86cf796a58c8a514
BLAKE2b-256 checksum
How to use checksums
f864ae51d6c88406ab8a685b0c83af9fc6ef4275982f391258d9167ddde88cf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.9

Release history Release notifications | RSS feed

This release

2.7.4 This release

1 release file

2.7.3

1 release file

2.7.2

1 release file

2.7.1

1 release file

2.6.1

1 release file

2.6.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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