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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3960189719f419563636784d5debf9ae1525d01a3cd78ca49038f0c54c393c05 |
|
MD5 | 73536a5cc292622056a7e4ba2f19e68f |
|
BLAKE2b-256 | 22b0b029032dbed3d2113fe77ee77d12ef5e5e8d88f8ff2c0c63e62d85f775bd |
Close
Hashes for tf_playwright_stealth-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede238cd063c0c04ed59909d4a3d4ed3f6db936f5b006b3f9e078235e9135811 |
|
MD5 | afeb71604503d91d185b2de5de9a920d |
|
BLAKE2b-256 | f962eae661d8329c6510ce6b28f51449a0f2663d08a76eed394b7da47cf9ae03 |