Skip to main content

Trying to make python selenium more stealthy.

Project description

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,
  language: str = "en-US,en",
  platform: str = "Win32",
  webgl_vendor: str = "Intel Inc.",
  renderer: str = "Intel Iris OpenGL Engine",
)

Test results

Pyppeteer without stealth

headless
headful

Pyppeteer with stealth

headless
headful

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

selenium-stealth-1.0.0.tar.gz (18.9 kB view hashes)

Uploaded Source

Built Distribution

selenium_stealth-1.0.0-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

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