mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-06-23 11:41:46 +02:00
Add examples/integrations/ with tested examples for browser-use, Crawl4AI, Scrapling, LangChain, Selenium, undetected-chromedriver, and agent-browser. Add js/examples/stagehand.ts for Stagehand (TypeScript). README: new "Framework Integrations" subsection with two integration patterns (direct binary launch vs CDP connect) and table linking all 8 examples.
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""undetected-chromedriver + CloakBrowser: double stealth layer.
|
|
|
|
undetected-chromedriver patches ChromeDriver detection signals,
|
|
CloakBrowser patches the browser fingerprints at the C++ level.
|
|
|
|
Requires: pip install undetected-chromedriver cloakbrowser
|
|
"""
|
|
|
|
import undetected_chromedriver as uc
|
|
|
|
from cloakbrowser.config import get_chromium_version, get_default_stealth_args
|
|
from cloakbrowser.download import ensure_binary
|
|
|
|
binary_path = ensure_binary()
|
|
stealth_args = get_default_stealth_args()
|
|
chromium_major = int(get_chromium_version().split(".")[0])
|
|
|
|
options = uc.ChromeOptions()
|
|
options.binary_location = binary_path
|
|
options.add_argument("--headless")
|
|
for arg in stealth_args:
|
|
options.add_argument(arg)
|
|
|
|
driver = uc.Chrome(options=options, version_main=chromium_major)
|
|
|
|
driver.get("https://example.com")
|
|
print(f"undetected-chromedriver + CloakBrowser: {driver.title}")
|
|
|
|
# Verify stealth
|
|
result = driver.execute_script("""
|
|
return {
|
|
webdriver: navigator.webdriver,
|
|
plugins: navigator.plugins.length,
|
|
platform: navigator.platform,
|
|
hardwareConcurrency: navigator.hardwareConcurrency,
|
|
}
|
|
""")
|
|
print(f"Stealth checks: {result}")
|
|
|
|
driver.quit()
|