Fork of https://github.com/AtuboDad/playwright_stealth
Project description
playwright_stealth
Transplanted from puppeteer-extra-plugin-stealth, Not perfect.
Install
$ pip install playwright-stealth
Usage
sync
from playwright.sync_api import sync_playwright
from playwright_stealth import stealth_sync
with sync_playwright() as p:
for browser_type in [p.chromium, p.firefox, p.webkit]:
browser = browser_type.launch()
page = browser.new_page()
stealth_sync(page)
page.goto('http://whatsmyuseragent.org/')
page.screenshot(path=f'example-{browser_type.name}.png')
browser.close()
async
# -*- coding: utf-8 -*-
import asyncio
from playwright.async_api import async_playwright
from playwright_stealth import stealth_async
async def main():
async with async_playwright() as p:
for browser_type in [p.chromium, p.firefox, p.webkit]:
browser = await browser_type.launch()
page = await browser.new_page()
await stealth_async(page)
await page.goto('http://whatsmyuseragent.org/')
await page.screenshot(path=f'example-{browser_type.name}.png')
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
Test results
playwright with stealth
playwright without stealth
Release
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
# sanity check
twine check dist/*
# upload
twine upload dist/*
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
Built Distribution
Close
Hashes for tf-playwright-stealth-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a413f77d064fb4bbd0e6a3e552387eb77f223bbf3e421d4716537739e8f4979c |
|
MD5 | 13f21b9db3c25b58dae0edb5f00bae0e |
|
BLAKE2b-256 | 0400ef20510f2ba35f8be0f405697198e1d842bc0c34737962f63a741da08888 |
Close
Hashes for tf_playwright_stealth-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a9b33acf5d758b9e332193849e23011f055e4cd51c72bd7ea526b35e19cb6ee |
|
MD5 | 48869d013fb76f0abca943f4d36e3e81 |
|
BLAKE2b-256 | 8cfa63efb5d67e18b08123a126c08fb8c16ddf3e745163eb5ad40e3cefb444a1 |