A wrapper to make python selenium stealthy.
Project description
Stealthenium 
Stealthenium is a Python package designed to prevent Selenium from being detected. Its primary goal is to enhance Selenium’s stealth capabilities ensuring smooth automation while bypassing detection systems. Currently, Stealthenium only supports Chrome and Remote WebDriver.
This project is a fork of the now-unmaintained selenium-stealth by diprajpatra, last updated on November 5 2020 as of August 23 2024. It serves as a Python equivalent of the JavaScript puppeteer-extra-plugin-stealth developed by berstend.
Features
- Passes public bot detection tests.
- Bypasses Cloudflare and other bot detection systems.
- Maintains a reasonable reCAPTCHA v3 score.
Installation
Stealthenium is available on PyPI. Install it via pip:
$ pip install stealthenium
Usage
from selenium import webdriver
from stealthenium import stealth
import time
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
# options.add_argument("--headless")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(
options=options,
service=webdriver.ChromeService(r"\chromedriver.exe")
)
stealth(driver,
languages=["en-US", "en"],
vendor="Google Inc.",
platform="Win32",
webgl_vendor="Intel Inc.",
renderer="Intel Iris OpenGL Engine",
fix_hairline=True,
)
url = "https://bot.sannysoft.com/"
driver.get(url)
time.sleep(5)
driver.quit()
Args
stealth(
driver: Driver,
user_agent: str = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36',
languages: [str] = ["en-US", "en"],
vendor: str = "Google Inc.",
platform: str = "Win32",
webgl_vendor: str = "Intel Inc.",
renderer: str = "Intel Iris OpenGL Engine",
fix_hairline: bool = False,
run_on_insecure_origins: bool = False,
)
Test results (red = bad)
Without stealthenium
With stealthenium
License
This project is licensed under the MIT License. See the LICENSE file for details.
© 2024 markmelnic
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stealthenium-1.1.1.tar.gz.
File metadata
- Download URL: stealthenium-1.1.1.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0db691632c9e899d17f7f1123f204de500df8b2c88a6cd25fb5bb1a09eadddb9
|
|
| MD5 |
578173a10ee73a2fd8ef8ab7bc01bf80
|
|
| BLAKE2b-256 |
e39573b45cb450de6038d38d606f529cd94fef06a4dfa9e55868742dca0c3029
|
File details
Details for the file stealthenium-1.1.1-py3-none-any.whl.
File metadata
- Download URL: stealthenium-1.1.1-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aa525d09a81c15e633882adaac2f70b124d21c2c3db2fd17cf443a2dcdeb70f
|
|
| MD5 |
5e2be815dd9457f9869f1338d9cce3ce
|
|
| BLAKE2b-256 |
a0da4aa0765135079242520f8f90abc1a51e48ade42d6ad5dd753cc20b518a74
|