Makes playwright stealthy like a ninja!
Project description
🥷🏻 tf-playwright-stealth
Transplanted from puppeteer-extra-plugin-stealth.
This is a package that makes playwright stealthy like a ninja by spoofing browser features in order to reduce the chance of detection.
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:
browser = p.chromium.launch(
headless=True,
)
page = browser.new_page()
stealth_sync(page)
page.goto("https://bot.sannysoft.com/")
page.screenshot(path=f"example_with_stealth.png", full_page=True)
browser.close()
async
from playwright.async_api import async_playwright
from playwright_stealth import stealth_async
with async_playwright() as p:
browser = await p.chromium.launch(
headless=True,
)
page = await browser.new_page()
await stealth_async(page)
await page.goto("https://bot.sannysoft.com/")
await page.screenshot(path=f"example_with_stealth_async.png", full_page=True)
await browser.close()
Results
From bot.sannysoft.com
Headless | Headful |
---|---|
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-1.0.2.tar.gz
.
File metadata
- Download URL: tf_playwright_stealth-1.0.2.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ac2a1060de5b8f76222001711eaad24a5cbeb9cd66f64e68b73039b06538f81 |
|
MD5 | 4ae18b9c2fec1a602c86359498b78923 |
|
BLAKE2b-256 | 7cebba8cb30e4669d8f09cc9a9dabd13fb3af690f2398bc34288b71fb6b903be |
File details
Details for the file tf_playwright_stealth-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: tf_playwright_stealth-1.0.2-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c88716b5ea886119cdbbfc35ec6cfd533bc2aea29b1998b8de49c43afeef9cc |
|
MD5 | a5edea95f5e18df4760d960bce6f1e54 |
|
BLAKE2b-256 | c8b1f2e19faa6298c7880379f8584ae55eec402bc480f0bc3e246fa2c4aac727 |