anticaptcha/lib.rs
1//! Official [Anti-Captcha.com](https://anti-captcha.com) API client.
2//!
3//! Solves image captchas, Recaptcha v2/v3 (Enterprise and non-Enterprise),
4//! hCaptcha, FunCaptcha (Arkose Labs), GeeTest v3/v4, Cloudflare Turnstile,
5//! Amazon WAF, Prosopo, Friendly Captcha, Altcha, and runs AntiGate custom
6//! scenarios.
7//!
8//! To use the service you need to [register](https://anti-captcha.com/clients/)
9//! and top up your balance. For the API details see the
10//! [documentation](https://anti-captcha.com/apidoc).
11//!
12//! # Example
13//!
14//! ```no_run
15//! use anticaptcha::{Client, RecaptchaV2};
16//!
17//! # async fn run() -> anticaptcha::Result<()> {
18//! let ac = Client::new("API_KEY_HERE");
19//!
20//! // Make sure the API key funds balance is positive
21//! println!("Balance: {}", ac.get_balance().await?);
22//!
23//! let solution = ac
24//! .solve_recaptcha_v2(&RecaptchaV2 {
25//! website_url: "https://www.website.com/".into(),
26//! website_key: "6Lcyu8UZAAAAACwSh6Xf58WrNXTu0LLu4F85xf20".into(),
27//! ..Default::default()
28//! })
29//! .await?;
30//!
31//! println!("g-response token: {}", solution.g_recaptcha_response());
32//! # Ok(())
33//! # }
34//! ```
35//!
36//! # Synchronous API
37//!
38//! Enable the `blocking` feature to get [`blocking::Client`], a synchronous
39//! mirror of the same methods:
40//!
41//! ```toml
42//! anticaptchaofficial = { version = "1", features = ["blocking"] }
43//! ```
44//!
45//! # Feature flags
46//!
47//! - `rustls-tls` *(default)* — TLS through rustls, no system OpenSSL needed
48//! - `native-tls` — TLS through the platform library
49//! - `blocking` — adds the synchronous [`blocking`] module
50
51#![forbid(unsafe_code)]
52#![warn(missing_debug_implementations)]
53
54#[cfg(feature = "blocking")]
55pub mod blocking;
56
57mod client;
58mod error;
59mod solution;
60mod tasks;
61
62/// Re-exported so you can build `variables` and `init_parameters` without
63/// adding `serde_json` to your own `Cargo.toml`.
64pub use serde_json;
65
66pub use client::Client;
67pub use error::{Error, Result};
68pub use solution::Solution;
69pub use tasks::{
70 Altcha, Amazon, AntiBotCookie, AntiGate, FriendlyCaptcha, FunCaptcha, GeeTest, HCaptcha,
71 ImageSettings, ImageToCoordinates, Prosopo, Proxy, ProxyType, RecaptchaV2, RecaptchaV3,
72 Turnstile,
73};
74
75/// Library version, e.g. `"1.0.0"`.
76pub const VERSION: &str = env!("CARGO_PKG_VERSION");