Package Exports
- 2captcha-ts
- 2captcha-ts/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (2captcha-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
English | Spanish | 中国语文科 | Русский
Description
A wrapper around the 2captcha API. This wrapper support reCAPTCHA V2, reCAPTCHA V3, hCaptcha, Arkose Labs FunCaptcha, image captcha, Сoordinates (Click Captcha), Geetest, Geetest V4, Yandex Smart Captcha, Lemin captcha, Amazon WAF, Cloudflare Turnstile, Capy Puzzle.
2captcha is a service that solves many different types of captchas, this library serves as a wrapper around their API to bring easy, promise-based functionality to NodeJS. This libary specilizes in concurrent solves, and bulk-api usage.
Features
- Promise based 2captcha solving
- Browser & NodeJS Support
- Uses node-fetch, a light weight http library
- Fluent typings & TS support
- Account Interaction
- Invalid Captcha reporting
- Proxy Support
Supported captchas:
- ✅ google-recaptcha (reCAPTCHA v2 / reCAPTCHA v3)
- ✅ hCaptcha
- ✅ Arkose Labs FunCaptcha
- ✅ Image captchas. (
base64format) - ✅ Geetest
- ✅ Geetest v4
- ✅ Yandex Smart Captcha
- ✅ Lemin Cropped Captcha
- ✅ Cloudflare Turnstile
- ✅ Amazon WAF Captcha
- ✅ Capy Puzzle
- ✅ Сoordinates (Click Captcha)
- ⬜ Audio Recogntion
Install
npm install 2captcha-tsyarn add 2captcha-tsUsage
reCAPTCHA:
const Captcha = require("2captcha-ts")
// A new 'solver' instance with your API key
const solver = new Captcha.Solver("<Your 2captcha api key>")
// Example reCAPTCHA Website
solver.recaptcha({
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})hCaptcha:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.hcaptcha({
pageurl: "https://2captcha.com/demo/hcaptcha?difficulty=moderate",
sitekey: "b76cd927-d266-4cfb-a328-3b03ae07ded6"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Arkose Labs FunCaptcha:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.funCaptcha({
pageurl: "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en",
publickey: "804380F4-6844-FFA1-ED4E-5877CA1F1EA4"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Image captcha:
const Captcha = require("2captcha-ts")
const fs = require("fs")
const solver = new Captcha.Solver("<Your 2captcha api key>")
// Read from a file as base64 text
const imageBase64 = fs.readFileSync("./tests/media/imageCaptcha_6e584.png", "base64")
solver.imageCaptcha({
body: imageBase64,
numeric: 4,
min_len: 5,
max_len: 5
})
.then((res) => {
// Logs the image text
console.log(res);
})
.catch((err) => {
console.log(err);
})GeeTest Captcha:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
// Read more about `challenge` on the page https://2captcha.com/p/geetest
solver.geetest({
pageurl: 'https://2captcha.com/demo/geetest',
gt: '81388ea1fc187e0c335c0a8907ff2625',
challenge: '<you need to get a new challenge value each time>'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})GeeTest V4 Captcha:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.geetestV4({
pageurl: 'https://2captcha.com/demo/geetest-v4',
captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Yandex Smart Captcha:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.yandexSmart({
pageurl: "https://captcha-api.yandex.ru/demo",
sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Lemin captcha:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.lemin({
pageurl:'https://dashboard.leminnow.com/auth/login',
captcha_id: 'CROPPED_099216d_34698cb7b8574265925f493cbcb3df4d',
div_id: 'lemin-cropped-captcha',
api_server: 'https://api.leminnow.com/captcha/v1/cropped'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Cloudflare Turnstile:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.cloudflareTurnstile({
pageurl: "https://app.nodecraft.com/login",
sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Amazon WAF Captcha (AWS WAF):
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
//INFO: The `context` value is dynamic, it is necessary to take the actual value from the page each time.
solver.amazonWaf({
pageurl: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
sitekey: "AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AHMDLodoefdvyOnsHMRt...",
context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ...",
iv: "CgAHbCe2GgAAAAAj",
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Capy Puzzle
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.capyPuzzle({
pageurl: "https://www.capy.me/account/register/",
captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Сoordinates (Click Captcha):
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
const imageBase64 = fs.readFileSync("./tests/media/hCaptchaImage.jpg", "base64")
solver.coordinates({
body: imageBase64,
textinstructions: 'Select all photos containing the boat'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})Proxy:
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("<Your 2captcha api key>")
solver.recaptcha({
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
proxy: "login:password@21.214.43.26", // The (Username : Password @ Address) of our chosen proxy
proxytype: "HTTP" // The 'Type' of proxy, http, https, socks, ect.
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err.message)
})Useful articles
- How to bypass Geetest v4 CAPTCHA
- Automatic reCAPTCHA V3 resolution - a tutorial for developers and customers
- Finding Sitekey hCaptcha
Usage examples with source code and description
- Solving GeeTest Captcha using Puppeteer
- Solving reCAPTCHA using Puppeteer
- Solving Yandex Smart Captcha using Puppeteer
This project is a fork of this package. In this version, new types of captchas have been added and the method of passing captcha parameters has been changed ({ using an object }) and etc. You can read more about the changes made here.