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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d15dfce4b71ecff4c3d96a9a092f0055d542d4c67ee4044fd4f2508b216be5ec |
|
MD5 | 90ff1eb9f040aa3306179e1dd86cd336 |
|
BLAKE2b-256 | 26d6db27a4c0ffe698d7c0a99c90dcdbf60f06b3df615bd7fdca2a0ee1660cd0 |
Close
Hashes for tf_playwright_stealth-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d835e1b0d72186008fa74a5ad3bee874605a0de28c67e3daaf8e84b85f17983 |
|
MD5 | c506316bd3fe36c576cc1510e23c6bc2 |
|
BLAKE2b-256 | 82a482314004d54aa75510a2e1726b896961ef653a7b6b8fe897e7491e6c79b5 |