cloudscraper-rs
A Cloudflare challenge solver that reimagines the Python cloudscraper ethos in Rust.
Status: This crate is still early-stage. Expect sharp edges, missing features, and ecosystem gaps while the Rust tooling for advanced bypass work catches up. Contributions and bug reports are welcome.
Quick Start
use CloudScraper;
async
Installation
[]
= "0.1"
= { = "1.0", = ["full"] }
Configuration
use UserAgentOptions;
let ua_opts = UserAgentOptions ;
let scraper = builder
.with_max_challenge_attempts // Retry budget for the pipeline
.with_user_agent_options // Customise UA/platform selection
.with_proxies // Optional proxy pool
.disable_adaptive_timing // Toggle subsystems as needed
.disable_ml_optimization
.build?;
See cloudscraper.rs for additional builder toggles (custom captcha provider, TLS config, spoofing consistency, etc.).
Supported Challenges
- ✅ Cloudflare v1 (IUAM)
- ✅ Cloudflare v2 (JavaScript + captcha)
- ✅ Cloudflare v3 (Managed JS VM)
- ✅ Cloudflare Turnstile
- ✅ Access Denied / Bot Management mitigations
- ✅ Rate limiting guidance
- ⚠️ Headless browser fallback (planned)
Architecture
CloudScraper
├─ Reqwest client pool (shared cookie jar, proxy aware)
├─ Challenge pipeline
│ ├─ detectors → pattern scoring / adaptive learning
│ ├─ solvers → javascript_v1/v2, managed_v3, turnstile, rate_limit, access_denied, bot_management
│ └─ mitigation planner → retries, proxy hints, wait suggestions
├─ Adaptive modules
│ ├─ anti_detection (header randomisation & cooldowns)
│ ├─ adaptive_timing (behavioural delays)
│ ├─ spoofing (consistent fingerprints & UAs)
│ ├─ tls (JA3 / cipher rotation)
│ ├─ metrics/events (telemetry + logging hooks)
│ └─ ml optimisation (feature scoring)
└─ State manager (per-domain history, error tracking)
Flow: request() → prepare headers/timing → fetch → detector identifies challenge → solver produces submission or mitigation → retry with solved tokens.
TODO
- Ship optional headless fallback integration
- Expand captcha provider catalogue
- Persist state/metrics for long-running bots
- Add first-class CLI / interactive probe tool
- Harden JavaScript VM sandboxing further
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Inspired by the Python cloudscraper library
Disclaimer
This library is for educational purposes only. Please respect website terms of service and robots.txt files. The authors are not responsible for misuse of this software.