Python module for preventing detection of CDP in Selenium, Puppeteer, and Playwright.
Project description
PyStealth 🕵️♂️
PyStealth is a powerful Python module designed to enhance the stealth capabilities of your web automation projects. It works seamlessly with popular frameworks like Selenium, Puppeteer, and Playwright to prevent detection of CDP.
🛡️ Key Features
- 🔒 Prevents stack trace access, making it harder to detect automation
- 🌐 Compatible with Selenium, Puppeteer, and Playwright
- 🎭 Enhances the stealth of your web scraping and testing projects
- 🔧 Easy to integrate with existing code
🔧 Installation
Install PyStealth easily with pip:
pip install pystealth
🚀 Quick Start
Here's how to use PyStealth with different frameworks:
Selenium
from selenium import webdriver
from pystealth import PyStealth
driver = webdriver.Chrome()
PyStealth.setup_selenium(driver)
Pyppeteer
import asyncio
from pyppeteer import launch
from pystealth import PyStealth
async def main():
browser = await launch()
page = await browser.newPage()
await PyStealth.setup_pyppeteer(page)
asyncio.get_event_loop().run_until_complete(main())
Playwright
from playwright.async_api import async_playwright
from pystealth import PyStealth
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await PyStealth.setup_playwright(page)
asyncio.run(main())
Playwright over CDP
import asyncio
from playwright.async_api import async_playwright
from pystealth import PyStealth
async def main():
port = 9222 # Replace with your CDP port
ws_endpoint = "/devtools/browser/..." # Replace with your WebSocket endpoint
async with async_playwright().start():
browser = await p.chromium.connect_over_cdp(f'ws://127.0.0.1:{port}{ws_endpoint}')
context = browser.contexts[0]
page = context.pages[0]
await PyStealth.setup_playwright(page)
# Your automation code here
await browser.close()
asyncio.run(main())
🤝 Contributing
Contributions, issues, and feature requests are welcome! Feel free to check issues page.
📜 License
Distributed under the MIT License. See LICENSE
for more information.
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
pystealth-1.0.0.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for pystealth-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 688232bd8ba01687de255961dc585fbd6f636c5a771396424cc34a857161175f |
|
MD5 | 741f424bc9f767741eee90a0d2c5ecf0 |
|
BLAKE2b-256 | f5089869508dead36703ff6196699d79fd1cd4f4e0953adc69fd04d67f957578 |