2captcha: Haskell package for easy integration with the 2captcha API.

[ deprecated, library, mit, network ] [ Propose Tags ]
Deprecated in favor of captcha-2captcha
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies aeson (>=1.5.6.0 && <1.6), base (>=4.7 && <5), bytestring (>=0.10.12.0 && <0.11), clock (>=0.8.2 && <0.9), exceptions (>=0.10.4 && <0.11), http-client (>=0.6.4.1 && <0.7), lens (>=4.19.2 && <4.20), lens-aeson (>=1.1.1 && <1.2), parsec (>=3.1.14.0 && <3.2), text (>=1.2.4.1 && <1.3), wreq (>=0.5.3.3 && <0.6) [details]
License MIT
Copyright 2021 qwbarch
Author qwbarch
Maintainer qwbarch@gmail.com
Revised Revision 2 made by qwbarch at 2022-09-24T05:49:45Z
Category Network
Home page https://github.com/qwbarch/2captcha-haskell#readme
Bug tracker https://github.com/qwbarch/2captcha-haskell/issues
Source repo head: git clone https://github.com/qwbarch/2captcha-haskell
Uploaded by qwbarch at 2021-09-09T05:13:30Z
Distributions
Downloads 226 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-09-09 [all 1 reports]

Readme for 2captcha-0.1.0.0

[back to package description]

2captcha-haskell

The easiest way to integrate 2captcha into your application to automate common types of captchas.

Table of Contents

Solving a captcha

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.

Normal 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 captchaTimeout

This 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 captchaTimeout

Text Captcha

This 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 captchaTimeout

ReCAPTCHA v2

ReCAPTCHA 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 reCAPTCHATimeout

ReCaptcha v3

ReCAPTCHA 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 reCAPTCHATimeout

FunCaptcha

FunCaptcha (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 captchaTimeout

GeeTest

GeeTest 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 captchaTimeout

hCaptcha

hCaptcha 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 captchaTimeout

KeyCaptcha

KeyCaptcha 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 captchaTimeout

Capy

Capy 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 captchaTimeout

Grid

This 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 captchaTimeout

Coordinate

This 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 captchaTimeout

Rotate

This 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 captchaTimeout

TikTok

TikTok 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