cloudscraper_rs/external_deps/captcha/
capsolver.rs1use super::{CaptchaConfig, CaptchaError, CaptchaProvider, CaptchaResult, CaptchaTask};
2use async_trait::async_trait;
3
4#[derive(Debug, Clone)]
6pub struct CapSolverProvider {
7 pub api_key: String,
8 pub config: CaptchaConfig,
9}
10
11impl CapSolverProvider {
12 pub fn new(api_key: impl Into<String>) -> Self {
13 Self {
14 api_key: api_key.into(),
15 config: CaptchaConfig::default(),
16 }
17 }
18
19 pub fn with_config(api_key: impl Into<String>, config: CaptchaConfig) -> Self {
20 Self {
21 api_key: api_key.into(),
22 config,
23 }
24 }
25}
26
27#[async_trait]
28impl CaptchaProvider for CapSolverProvider {
29 fn name(&self) -> &'static str {
30 "capsolver"
31 }
32
33 async fn solve(&self, _task: &CaptchaTask) -> CaptchaResult {
34 Err(CaptchaError::NotImplemented(self.name()))
35 }
36}