Fork of https://github.com/AtuboDad/playwright_stealth
Project description
playwright_stealth
Transplanted from puppeteer-extra-plugin-stealth, Not perfect.
It was originally forked from https://github.com/AtuboDad/playwright_stealth which doesn't seem to be maintained anymore.
Install
pip install tf-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
Release history Release notifications | RSS feed
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
File details
Details for the file tf-playwright-stealth-0.0.6.tar.gz
.
File metadata
- Download URL: tf-playwright-stealth-0.0.6.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd94e6c94f50a1fa2f67187a54e7cdec37d0e325a978e35e0175cbe4ac6680a2 |
|
MD5 | 92f19e335a4f36a8ef8008dcf1aaa3ee |
|
BLAKE2b-256 | 86df3dc7e2f142dc207461ae596da8750300eb326e76b379afe7f4f6b482e14e |
File details
Details for the file tf_playwright_stealth-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: tf_playwright_stealth-0.0.6-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0ed8ebc3acc43a639f4bda63ebfe25d20aa825d421b8e2b2d086c490b639ebf |
|
MD5 | 1861145f55512f96110de93f9312713f |
|
BLAKE2b-256 | d99c4f41f70bffe832babb87a31da47a8bfc511f7d6446112ccf3876b5804912 |