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.1.tar.gz
.
File metadata
- Download URL: tf_playwright_stealth-1.0.1.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 | 124b24437e562854820d6dcc0c2c02fc0b765407b74b2ec894a9b8aae40c69e0 |
|
MD5 | 123c4c998030bbf2cf836c951605c02d |
|
BLAKE2b-256 | 5656e09b59279145da85754ecf8265ac953bfdfac5701811cea23d8df322affe |
File details
Details for the file tf_playwright_stealth-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: tf_playwright_stealth-1.0.1-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 | 59907a9ac27c2369aa84fccce59d260e0d7aa5a75809b912911dfd1ec95667a8 |
|
MD5 | 9b255facabf33084ad6e611a0256e1b6 |
|
BLAKE2b-256 | 21e5e95b604ddf287be62b18253bb54b82e35e26b042f3c56956c9390d3272ac |