JavaScript library for easy integration with the API of 2captcha captcha solving service to bypass reCAPTCHA, hCaptcha, funcaptcha, geetest and solve any other captchas.
npm install 2captcha-ts-jsEnglish | Spanish | 中国语文科 | Русский
bounding_box. Метод ограничивающей рамки позволяет размечать данные на изображении. Этот метод можно использовать для разметки наборов данных или выделения любых объектов на изображении в соответствии с заданными инструкциями. Подробнее об использовании Bounding Box Method читайте в документации.
promise.
base64 format)
sh
npm install 2captcha-ts
`
`sh
yarn add 2captcha-ts
`
Примеры использования
$3
`js
const Captcha = require("2captcha-ts")
// Новый экземпляр "solver" со значением вашего ключа 2captcha API
const solver = new Captcha.Solver("")
// Решение reCAPTCHA, на демо странице содержащей reCAPTCHA V2
solver.recaptcha({
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
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);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
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);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const fs = require("fs")
const solver = new Captcha.Solver("")
// Получаем содержимое файла в формате base64
const imageBase64 = fs.readFileSync("./tests/media/imageCaptcha_6e584.png", "base64")
solver.imageCaptcha({
body: imageBase64,
numeric: 4,
min_len: 5,
max_len: 5
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
// Значение challenge является динамическим
// Читайте подробнее о challenge на странице https://2captcha.com/p/geetest
solver.geetest({
pageurl: 'https://2captcha.com/demo/geetest',
gt: '81388ea1fc187e0c335c0a8907ff2625',
challenge: ''
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.geetestV4({
pageurl: 'https://2captcha.com/demo/geetest-v4',
captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.yandexSmart({
pageurl: "https://captcha-api.yandex.ru/demo",
sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
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);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.cloudflareTurnstile({
pageurl: "https://app.nodecraft.com/login",
sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
// INFO: Значение context является динамическим, необходимо каждый раз брать фактическое значение со страницы с капчей.
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);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.capyPuzzle({
pageurl: "https://www.capy.me/account/register/",
captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.dataDome({
pageurl: "https://rendezvousparis.hermes.com/client/register",
captcha_url: "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAEuQtkf4k1c0ABZhYZA%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=mY4z7GNmh7Nt1lAFwpbNHAOcWPhyPgjHD2K1Pm~Od1iEKYLUnK3t7N2ZGUj8OqDK65cnwJHtHwd~t902vlwpSBA5l4ZHbS1Qszv~jEuEUJNQ_jMAjar2Kj3kq20MRJYh&t=fe&referer=https%3A%2F%2Frendezvousparis.hermes.com%2Fclient%2Fregister&s=40119&e=67fef144ac1a54dbd7507776367d2f9d5e36ec3add17fa22f3cb881db8385838",
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
proxy: "login:password@1.2.3.4:8888", // The (Username : Password @ Address : Port) of our chosen proxy
proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.cyberSiARA({
pageurl: "https://www.cybersiara.com/book-a-demo",
master_url_id: "OXR2LVNvCuXykkZbB8KZIfh162sNT8S2",
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.mtCaptcha({
pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
sitekey: "MTPublic-DemoKey9M"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
Используйте этот метод, чтобы решить Friendly Captcha и получить токен для обхода защиты.
> Важно:Для успешного использования полученного токена, на странице не должен быть загружен виджет капчи. Для этого вам нужно прервать запрос к /friendcaptcha/...module.min.js на странице. Когда виджет капчи уже загружен на страницу, велика вероятность, что полученный токен не сработает.
`js
solver.friendlyCaptcha({
pageurl: "https://geizhals.de/?liftban=1&from=/455973138?fsean=5901747021356",
sitekey: "FCMST5VUMCBOCGQ9"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
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);
})
`
$3
Bounding Box Method позволяет выбирать объекты, указанные на изображении. Для этого вам необходимо передать инструкции по разметке. Инструкции могут быть отправлены в виде текста или изображения, закодированного в формате base64. Обязательно необходимо передать хотя бы одну инструкцию imginstructions или textinstructions.
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.boundingBox({
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
textinstructions: "Обведите все машины на изображении.",
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
`
$3
`js
const Captcha = require("2captcha-ts")
const solver = new Captcha.Solver("")
solver.recaptcha({
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
proxy: "login:password@1.2.3.4:8888", // Параметры используемого вами прокси сервера
proxytype: "HTTP" // Тип используемого прокси: HTTP, HTTPS, SOCKS4, SOCKS5.
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err.message)
})
`
Полезные статьи
* Как решать капчу Geetest v4
* Автоматическое решение reCAPTCHA V3 - инструкция для разработчиков и заказчиков
* Поиск значения sitekey` для hCaptcha