Note: This package is deprecated by captcha-haskell.
The easiest way to integrate 2captcha into your application to automate common types of captchas.
Solving a captcha using 2captcha's api is through the in.php and res.php endpoints.
This package encapsulates the mentioned endpoints through submit and answer.
If you'd like to poll for the answer, use solve.
Default timeout: 120 seconds.
ReCAPTCHA timeout: 600 seconds.
Polling interval: 10 seconds
Below are the minimal required parameters to solve each type of captcha.
This function can be used to solve a local image captcha.
let captcha =
normalCaptcha
& apiKey ?~ "YOUR_API_KEY"
& method ?~ "post"
& file ?~ "/path/to/file"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutThis function can be used to solve a captcha encoded in base-64 form.
let captcha =
normalCaptcha
& apiKey ?~ "YOUR_API_KEY"
& method ?~ "base64"
& body ?~ "BASE_64_ENCODED_IMAGE"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutThis function can be used to solve captchas in text form.
let captcha =
textCaptcha
& apiKey ?~ "YOUR_API_KEY"
& textContent ?~ "If tomorrow is Saturday, what day is it today?"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutReCAPTCHA v2 requires a k or data-sitekey value found on the captcha page.
let captcha =
reCAPTCHAV2
& apiKey ?~ "YOUR_API_KEY"
& googleKey ?~ "GOOGLE_KEY_VALUE"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval reCAPTCHATimeoutReCAPTCHA v3 requires a k or data-sitekey value found on the captcha page.
let captcha =
reCAPTCHAV3
& apiKey ?~ "YOUR_API_KEY"
& googleKey ?~ "GOOGLE_KEY_VALUE"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval reCAPTCHATimeoutFunCaptcha (ArkoseLabs) requires a pk or data-pkey value found on the captcha page.
let captcha =
funCaptcha
& apiKey ?~ "YOUR_API_KEY"
& publicKey ?~ "PUBLIC_KEY"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutGeeTest requires the gt, challenge, and api_server values on the captcha page.
let captcha =
geeTestCaptcha
& apiKey ?~ "YOUR_API_KEY"
& gt ?~ "GT_VALUE"
& apiServer ?~ "API_SERVER"
& challenge ?~ "CAPTCHA_CHALLENGE"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval captchaTimeouthCaptcha requires the data-sitekey value on the captcha page.
let captcha =
hCaptcha
& apiKey ?~ "YOUR_API_KEY"
& siteKey ?~ "SITE_KEY"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutKeyCaptcha requires the s_s_c_user_id, s_s_c_session_id, s_s_c_web_server_sign, and s_s_c_web_server_sign2 values on the captcha page.
let captcha =
keyCaptcha
& apiKey ?~ "YOUR_API_KEY"
& userId ?~ "USER_ID_VALUE"
& sessionId ?~ "SESSION_ID_VALUE"
& webServerSign ?~ "WEB_SERVER_SIGN_VALUE"
& webServerSign2 ?~ "WEB_SERVER_SIGN_2_VALUE"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutCapy requires the captchakey value on the captcha page.
let captcha =
capyCaptcha
& apiKey ?~ "YOUR_API_KEY"
& captchaKey ?~ "CAPTCHA_KEY"
& pageUrl ?~ "PAGE_URL"
& scriptDomain ?~ "SCRIPT_DOMAIN"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutThis function can be used to solve a local grid image captcha.
let captcha =
gridCaptcha
& apiKey ?~ "YOUR_API_KEY"
& method ?~ "post"
& file ?~ "/path/to/file"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutThis function can be used to solve a local coordinate image captcha.
let captcha =
coordinateCaptcha
& apiKey ?~ "YOUR_API_KEY"
& method ?~ "post"
& file ?~ "/path/to/file"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutThis function can be used to solve a local rotate image captcha.
let captcha =
rotateCaptcha
& apiKey ?~ "YOUR_API_KEY"
& file ?~ "/path/to/file"
session <- newAPISession
solve session captcha pollingInterval captchaTimeoutTikTok requires the aid and host values on the captcha page.
let captcha =
tikTokCaptcha
& apiKey ?~ "YOUR_API_KEY"
& cookies ?~ "YOUR_COOKIES"
& aid ?~ 0
& host ?~ "HOST_VALUE"
& pageUrl ?~ "PAGE_URL"
session <- newAPISession
solve session captcha pollingInterval captchaTimeout