Skip to main content

ezcapsolver/tasks/
funcaptcha.rs

1use serde::Serialize;
2
3use super::ExtraFields;
4
5/// FunCaptcha token task.
6#[derive(Debug, Clone, Serialize, Default, bon::Builder)]
7#[builder(on(String, into))]
8#[serde(remote = "Self", rename_all = "camelCase")]
9pub struct FunCaptchaTask {
10    /// URL of the page containing the challenge.
11    #[serde(rename = "websiteURL")]
12    pub website_url: String,
13    /// FunCaptcha public key.
14    pub website_key: String,
15    /// Optional Arkose Labs blob data.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub data: Option<String>,
18    /// Optional Arkose Labs API subdomain.
19    #[serde(
20        rename = "funcaptchaApiJSSubdomain",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub api_js_subdomain: Option<String>,
24    /// Optional worker proxy.
25    ///
26    /// FunCaptcha is the only task type using the `FUN` proxy format —
27    /// `protocol://host:port:username:password`, with the credentials appended
28    /// rather than placed before the host. Every other type takes
29    /// `protocol://username:password@host:port`.
30    ///
31    /// Either way the service requires both a username and a password: an
32    /// unauthenticated proxy is rejected.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub proxy: Option<String>,
35    /// Whether the supplied proxy is in mainland China.
36    #[builder(default)]
37    pub cn: bool,
38    /// Additional worker parameters.
39    #[serde(skip)]
40    #[builder(default)]
41    pub extra: ExtraFields,
42}
43
44/// FunCaptcha image classification task.
45#[derive(Debug, Clone, Serialize, Default, bon::Builder)]
46#[builder(on(String, into))]
47#[serde(remote = "Self", rename_all = "camelCase")]
48pub struct FunCaptchaClassificationTask {
49    /// Base64-encoded challenge image.
50    pub image: String,
51    /// Classification question.
52    pub question: String,
53    /// Additional worker parameters.
54    #[serde(skip)]
55    #[builder(default)]
56    pub extra: ExtraFields,
57}