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
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
Close
Hashes for playwright_stealth_plus-1.0.601.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7972563cc92441581c3072058c6f286d0354dde212c5d9ac8b913a3960ce8a |
|
MD5 | 70ddccba10b74f9cd74ad27c507c4d74 |
|
BLAKE2b-256 | 9d35298c153c90ef11d103b7bca9f2fad366e529857932d11b7b1259cb73e378 |
Close
Hashes for playwright_stealth_plus-1.0.601-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c7f5b586a1d25552650fa007ee11a105d9dc4e5fdeb990dc898eab12ba75551 |
|
MD5 | 1bb0ed1edf58357506c97a4446794363 |
|
BLAKE2b-256 | 1eff9206cdbe7be5a6497ff56e1283df46a0ffa875f390db641aa706e6df9463 |