cloudscraper_rs/
lib.rs

1//! # cloudscraper-rs
2//!
3//! A Rust-first take on Cloudflare challenge solving inspired by the classic
4//! Python Cloudscraper.
5//!
6//! The crate is still early-stage. Expect rough edges while the detection
7//! pipeline, adaptive modules, and captcha integrations continue to evolve.
8//!
9//! ## Features
10//!
11//! - Fast and efficient async HTTP client
12//! - Support for Cloudflare v1, v2, v3, and Turnstile challenges
13//! - Browser fingerprinting and User-Agent rotation
14//! - Automatic proxy rotation
15//! - Stealth mode with human-like behavior
16//! - Custom TLS cipher suites
17//! - Automatic cookie management
18//!
19//! ## Example
20//!
21//! ```no_run
22//! use cloudscraper_rs::CloudScraper;
23//!
24//! #[tokio::main]
25//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
26//!     let scraper = CloudScraper::new()?;
27//!     let response = scraper.get("https://example.com").await?;
28//!     println!("Response: {}", response.text().await?);
29//!     Ok(())
30//! }
31//! ```
32
33mod cloudscraper;
34
35pub mod challenges;
36pub mod external_deps;
37pub mod modules;
38
39pub use crate::cloudscraper::{
40    CloudScraper, CloudScraperBuilder, CloudScraperConfig, CloudScraperError, CloudScraperResult,
41    ScraperResponse,
42};
43
44pub use crate::challenges::core::{
45    ChallengeExecutionError, ChallengeHttpClient, ChallengeHttpClientError, ChallengeHttpResponse,
46    ChallengeResponse, ChallengeSubmission, OriginalRequest, ReqwestChallengeHttpClient,
47    execute_challenge_submission,
48};
49
50pub use crate::challenges::detectors::{
51    ChallengeDetection, ChallengeDetector, ChallengeType, ResponseStrategy,
52};
53
54pub use crate::challenges::pipeline::{
55    ChallengePipeline, ChallengePipelineResult, PipelineContext, PipelineError, UnsupportedReason,
56};
57
58pub use crate::challenges::solvers::{
59    FailureRecorder, FingerprintManager, MitigationPlan, TlsProfileManager,
60};
61
62pub use crate::challenges::user_agents::{
63    UserAgentError, UserAgentOptions, UserAgentProfile, get_user_agent_profile,
64};
65
66pub use crate::external_deps::captcha::{
67    AntiCaptchaProvider, CapSolverProvider, CaptchaConfig, CaptchaError, CaptchaProvider,
68    CaptchaResult, CaptchaSolution, CaptchaTask, TwoCaptchaProvider,
69};
70
71pub use crate::external_deps::interpreters::{
72    BoaJavascriptInterpreter, InterpreterError, InterpreterResult, JavascriptInterpreter,
73};
74
75pub use crate::modules::{
76    AdaptiveTimingStrategy, AntiDetectionContext, AntiDetectionStrategy, BehaviorProfile,
77    BrowserFingerprint, BrowserProfile, BrowserType, ChallengeEvent, ConsistencyLevel,
78    DefaultAdaptiveTiming, DefaultAntiDetection, DefaultTLSManager, DomainState, DomainStats,
79    DomainTimingSnapshot, ErrorEvent, EventDispatcher, EventHandler, FeatureVector,
80    FingerprintGenerator, GlobalStats, LoggingHandler, MLOptimizer, MetricsCollector,
81    MetricsHandler, MetricsSnapshot, PerformanceConfig, PerformanceMonitor, PerformanceReport,
82    PostResponseEvent, PreRequestEvent, ProxyConfig, ProxyHealthReport, ProxyManager, RequestKind,
83    RetryEvent, RotationStrategy, ScraperEvent, StateManager, StrategyRecommendation, TLSConfig,
84    TimingOutcome, TimingRequest,
85};
86
87/// Library version
88pub const VERSION: &str = env!("CARGO_PKG_VERSION");