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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2824ce5571c08891446d079143027da0df6a4fed6f555115064995cb6144f90a |
|
MD5 | 8afcb72812c0c064b30c02903d187d10 |
|
BLAKE2b-256 | 1c75ce8e05f520082472a0c93c02502bda2116790e7cc2f00517bd153e491a3e |
Close
Hashes for tf_playwright_stealth-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4658e192d82ec5a1fc26dd368e1ed84dd3666def62bf1b36c2fb452ae2a2befd |
|
MD5 | fce024e7cfa346b610cdc9232d6834e4 |
|
BLAKE2b-256 | d5536895a1e57c4781923f3c458939fbaee2e2ed6de528e76ccd489d51de3bf8 |