1use async_trait::async_trait;
2use px_errors::AppError;
3use px_pipeline::{ChallengeHandler, HandlerOutcome, PageHtml};
4
5pub struct DataDomeHandler;
6
7impl DataDomeHandler {
8 pub fn new() -> Self {
9 Self
10 }
11}
12
13impl Default for DataDomeHandler {
14 fn default() -> Self {
15 Self::new()
16 }
17}
18
19#[async_trait]
20impl ChallengeHandler for DataDomeHandler {
21 fn name(&self) -> &'static str {
22 "datadome"
23 }
24
25 async fn detects(&self, page: &PageHtml) -> Result<bool, AppError> {
26 let h = &page.html;
27 Ok(h.contains("DD_OPTIONS")
28 || h.contains("datadome.co/captcha")
29 || h.contains("ddg_datadome"))
30 }
31
32 async fn solve(&self, _page: &PageHtml) -> Result<HandlerOutcome, AppError> {
33 Ok(HandlerOutcome::not_implemented(self.name()))
34 }
35}