@captcha-libs/capguru
Version:
CapGuru NodeJS client, captcha recognition service
920 lines (868 loc) • 37.4 kB
JavaScript
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// ../captcha-client/src/captcha-client.ts
var _CaptchaClient = class _CaptchaClient {
};
__name(_CaptchaClient, "CaptchaClient");
__publicField(_CaptchaClient, "baseUrl");
var CaptchaClient = _CaptchaClient;
// ../captcha-client/src/utils.ts
var delay = /* @__PURE__ */ __name((timeout) => __async(void 0, null, function* () {
return yield new Promise((resolve) => setTimeout(resolve, timeout));
}), "delay");
// src/lib/capguru.ts
var _nodefetch = require('node-fetch'); var _nodefetch2 = _interopRequireDefault(_nodefetch);
var _CapGuru = class _CapGuru extends CaptchaClient {
/**
* @param {object} [params] - CaptchaClientParams
* @param {string} [params.clientKey] - YOUR_API_KEY from dashboard
* @param {number} [params.timeout] - max timeout to getTaskResult, default = 120000
* @param {number} [params.pollingInterval] - polling interval to getTaskResult, default = 5000
* @param {number} [params.baseUrl] - base url for capguru, default = "https://api3.cap.guru/"
*/
constructor(params) {
const { clientKey, timeout = 12e4, pollingInterval = 5e3, baseUrl = "https://api3.cap.guru/" } = params;
super();
/**
* @type {string} clientKey - YOUR_API_KEY from dashboard
*/
__publicField(this, "clientKey");
/**
* @type {number} pollingInterval - polling interval to getTaskResult in ms. Default to 5000
*/
__publicField(this, "pollingInterval");
/**
* @type {number} timeout - max timeout to getTaskResult in ms. Default to 120_000
*/
__publicField(this, "timeout");
/**
* @type {string} baseUrl - base api url
*/
__publicField(this, "baseUrl");
__publicField(this, "softguru", "140559");
this.clientKey = clientKey;
this.pollingInterval = pollingInterval;
this.timeout = timeout;
this.baseUrl = baseUrl;
}
getBalance() {
return __async(this, null, function* () {
const query = new URLSearchParams({
"action": "getbalance",
"json": "1",
"key": `${this.clientKey}`
});
const body = yield _nodefetch2.default.call(void 0, `${this.baseUrl}/res.php`, {
"method": "GET",
"body": query
});
const response = yield body.json();
const { request, status } = response;
if (!status) throw new Error(`CapGuru: ${request}`);
return request;
});
}
parseSolution(response, request) {
if (response.startsWith("coordinate")) {
const stringCoordinatePairs = response.split(";");
const parsedCoordinatePairs = stringCoordinatePairs.map((pair) => {
const match = pair.match(new RegExp("x=(?<x>[-+]?\\d*\\.?\\d+),y=(?<y>[-+]?\\d*\\.?\\d+)(?:,w=(?<w>[-+]?\\d*\\.?\\d+))?"));
if (!match) return;
const { groups } = match;
if (!groups) return;
const coordinates = Object.fromEntries(Object.entries(groups).filter(([, v]) => v).map(([k, v]) => [
k,
Number(v)
]));
return coordinates;
});
if (!parsedCoordinatePairs || !parsedCoordinatePairs.length) return;
if ("isMultipleCoordinates" in request && request["isMultipleCoordinates"]) return parsedCoordinatePairs;
else return parsedCoordinatePairs[0];
}
if (response.split(",").length && response.split(",").every(Number)) return response.split(",").map(Number);
return response;
}
/**
* @param {object} request - task payload to create task
* @return {Promise<CapGuruCreateTaskResponse<TSolution>>} - response of createTask
*/
createTask(request) {
return __async(this, null, function* () {
const body = yield _nodefetch2.default.call(void 0, `${this.baseUrl}/in.php`, {
"body": JSON.stringify(__spreadValues({
"json": 1,
"key": this.clientKey,
"softguru": this.softguru
}, request)),
"method": "POST"
});
const response = yield body.json();
const { status, "request": responseDetail } = response;
if (!status) throw new Error(`CapGuru: ${responseDetail}`);
return responseDetail;
});
}
/**
* @param {Requests} request - task payload to create task
* @return {Promise<CapGuruSolution<TSolution>>} - response of createTask
*/
solve(request) {
return __async(this, null, function* () {
const balance = yield this.getBalance();
if (!balance) throw new Error("CapGuru: ERROR_ZERO_BALANCE");
const _a = __spreadValues({}, request), { isMultipleCoordinates: _isMultipleCoordinates = false, isSingleCoordinate: _isSingleCoordinate = false, isGrid: _isGrid = false, isString: _isString = false } = _a, payload = __objRest(_a, ["isMultipleCoordinates", "isSingleCoordinate", "isGrid", "isString"]);
const taskId = yield this.createTask(payload);
const abortSignal = AbortSignal.timeout(this.timeout);
const isAborted = abortSignal.aborted;
try {
while (!isAborted) {
const body = yield _nodefetch2.default.call(void 0, `${this.baseUrl}/res.php`, {
"body": JSON.stringify({
"action": "get",
"id": taskId,
"json": 1,
"key": this.clientKey
}),
"method": "POST",
"signal": abortSignal
});
const data = yield body.json();
if (!data.status && data.request !== "CAPCHA_NOT_READY") {
return Promise.reject(`CapGuru: ${data.request}`);
} else if (data.status) {
const parsedSolution = this.parseSolution(data.request, request);
const solutionResponse = __spreadProps(__spreadValues({}, data), {
"solution": parsedSolution
});
return Promise.resolve(solutionResponse);
}
yield delay(this.pollingInterval);
}
} catch (error) {
if (error instanceof _nodefetch.AbortError && error.name === "AbortError") throw new Error(`CapGuru timeout ${this.timeout} exceeded!`);
else throw new Error("CapGuru unknown error!");
}
throw new Error("CapGuru finished with error");
});
}
};
__name(_CapGuru, "CapGuru");
var CapGuru = _CapGuru;
// src/lib/Request/_BaseTaskRequest.ts
var _BaseTask = class _BaseTask {
constructor({ method }) {
/**
* @type {TaskMethods} method - task type/method
*/
__publicField(this, "method");
this.method = method;
}
};
__name(_BaseTask, "BaseTask");
var BaseTask = _BaseTask;
// src/lib/Request/Recognition/_RecognitionBaseTask.ts
var _RecognitionBaseTask = class _RecognitionBaseTask extends BaseTask {
constructor({ click, body, textinstructions }) {
super({
"method": "base64"
});
__publicField(this, "click");
__publicField(this, "body");
__publicField(this, "textinstructions");
this.click = click;
this.body = body;
this.textinstructions = textinstructions;
}
};
__name(_RecognitionBaseTask, "RecognitionBaseTask");
var RecognitionBaseTask = _RecognitionBaseTask;
// src/lib/Request/Recognition/AmazonCarPathTask.ts
var _AmazonCarPathTask = class _AmazonCarPathTask extends RecognitionBaseTask {
/**
* Create Amazon car path task
* This task uses click='oth' and textinstructions='Amazon,Place a dot at the end of the car's path'
* @see {@link https://docs.cap.guru/en/apiclick/aws.html}
* @param {AmazonCarPathParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "oth",
"textinstructions": "Amazon,Place a dot at the end of the car's path"
}));
/**
* @type {boolean} isSingleCoordinate - only used for correctly working method overloading intellisense
*/
__publicField(this, "isSingleCoordinate", true);
}
};
__name(_AmazonCarPathTask, "AmazonCarPathTask");
var AmazonCarPathTask = _AmazonCarPathTask;
// src/lib/Request/Recognition/AmazonPuzzleTask.ts
var _AmazonPuzzleTask = class _AmazonPuzzleTask extends RecognitionBaseTask {
/**
* Create Amazon puzzle task
* This task uses click='geetest' and textinstructions='slider'
* @see {@link https://docs.cap.guru/en/apiclick/aws.html}
* @param {AmazonPuzzleParams} params - params
* @param {string} [params.textinstructions] - For example: Slide the image to complete the pyramid. Tasks are supported only in English!
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "oth"
}));
/**
* @type {boolean} isSingleCoordinate - only used for correctly working method overloading intellisense
*/
__publicField(this, "isSingleCoordinate", true);
}
};
__name(_AmazonPuzzleTask, "AmazonPuzzleTask");
var AmazonPuzzleTask = _AmazonPuzzleTask;
// src/lib/Request/Recognition/BinanceGridTask.ts
var _BinanceGridTask = class _BinanceGridTask extends RecognitionBaseTask {
/**
* Create binance grid task
* This task uses click='geetest'
* @see {@link https://docs.cap.guru/en/apiclick/binance.html}
* @param {BinanceGridParams} params - params
* @param {string} [params.textinstructions] - For example: binance,bear. Only tasks in English are supported!
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "geetest2"
}));
/**
* @type {boolean} isGrid - only used for correctly working method overloading intellisense
*/
/**
* @type {boolean} isGrid - only used for correctly working method overloading intellisense
*/
__publicField(this, "isGrid", true);
}
};
__name(_BinanceGridTask, "BinanceGridTask");
var BinanceGridTask = _BinanceGridTask;
// src/lib/Request/Recognition/BinancePuzzleTask.ts
var _BinancePuzzleTask = class _BinancePuzzleTask extends RecognitionBaseTask {
/**
* Create binance grid task
* This task uses click='geetest' and textinstructions='binance,slider'
* @see {@link https://docs.cap.guru/en/apiclick/binance.html}
* @param {BinanceGridParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "geetest",
"textinstructions": "binance,slider"
}));
/**
* @type {boolean} isSingleCoordinate - only used for correctly working method overloading intellisense
*/
__publicField(this, "isSingleCoordinate", true);
}
};
__name(_BinancePuzzleTask, "BinancePuzzleTask");
var BinancePuzzleTask = _BinancePuzzleTask;
// src/lib/Request/Recognition/BuxMoneyCoordinatesTask.ts
var _BuxMoneyCoordinatesTask = class _BuxMoneyCoordinatesTask extends RecognitionBaseTask {
/**
* Create BuxMoney coordinates task. This method allows you to solve bux.money and payup.video, with image clicks. We detect objects on the captcha and send you the coordinates for clicking.
* This task uses click='oth' and textinstructions='custom1223'
* @see {@link https://docs.cap.guru/en/apiclick/other/seofast.html}
* @param {BuxMoneyCoordinatesParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "oth",
"textinstructions": "custom1223"
}));
/**
* @type {boolean} isMultipleCoordinates - only used for correctly working method overloading intellisense
*/
__publicField(this, "isMultipleCoordinates", true);
}
};
__name(_BuxMoneyCoordinatesTask, "BuxMoneyCoordinatesTask");
var BuxMoneyCoordinatesTask = _BuxMoneyCoordinatesTask;
// src/lib/Request/Recognition/FunCaptchaGridTask.ts
var _FunCaptchaGridTask = class _FunCaptchaGridTask extends RecognitionBaseTask {
/**
* Create FunCaptcha grid task
* This task uses click='funcap2'
* @see {@link https://docs.cap.guru/en/apiclick/funcap.html}
* @param {FunCaptchaGridParams} params - params
* @param {string} [params.textinstructions] - For example: Pick the spiral galaxy
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "funcap2"
}));
/**
* @type {boolean} isGrid - only used for correctly working method overloading intellisense
*/
__publicField(this, "isGrid", true);
}
};
__name(_FunCaptchaGridTask, "FunCaptchaGridTask");
var FunCaptchaGridTask = _FunCaptchaGridTask;
// src/lib/Request/Recognition/GenericPuzzleTask.ts
var _GenericPuzzleTask = class _GenericPuzzleTask extends RecognitionBaseTask {
/**
* Create Puzzle task
* This task uses click='geetest' and textinstructions='slider'
* @see {@link https://docs.cap.guru/en/api/slider.html}
* @param {GenericPuzzleTaskParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "geetest",
"textinstructions": "slider"
}));
/**
* @type {boolean} isSingleCoordinate - only used for correctly working method overloading intellisense
*/
__publicField(this, "isSingleCoordinate", true);
}
};
__name(_GenericPuzzleTask, "GenericPuzzleTask");
var GenericPuzzleTask = _GenericPuzzleTask;
// src/lib/Request/Recognition/GeeTestPuzzleTask.ts
var _GeeTestPuzzleTask = class _GeeTestPuzzleTask extends GenericPuzzleTask {
/**
* Create GeeTest Puzzle task
* This task uses click='geetest' and textinstructions='slider'
* @see {@link https://docs.cap.guru/en/apiclick/geetest.html}
* @param {GeeTestGridParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(params);
}
};
__name(_GeeTestPuzzleTask, "GeeTestPuzzleTask");
var GeeTestPuzzleTask = _GeeTestPuzzleTask;
// src/lib/Request/Recognition/HCaptchaCoordinatesTask.ts
var _HCaptchaCoordinatesTask = class _HCaptchaCoordinatesTask extends RecognitionBaseTask {
/**
* Create HCaptcha coordinates task
* This task uses click='hcap'
* @see {@link https://docs.cap.guru/en/apiclick/hcap.html}
* @param {HCaptchaCoordinatesParams} params - params
* @param {string} [params.textinstructions] - For example: bear. Tasks are supported only in English!
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "hcap"
}));
/**
* @type {boolean} isMultipleCoordinates - only used for correctly working method overloading intellisense
*/
__publicField(this, "isMultipleCoordinates", true);
}
};
__name(_HCaptchaCoordinatesTask, "HCaptchaCoordinatesTask");
var HCaptchaCoordinatesTask = _HCaptchaCoordinatesTask;
// src/lib/Request/Recognition/HCaptchaGridTask.ts
var _HCaptchaGridTask = class _HCaptchaGridTask extends RecognitionBaseTask {
/**
* Create HCaptcha grid task
* This task uses click='hcap2'
* @see {@link https://docs.cap.guru/en/apiclick/hcap.html}
* @param {HCaptchaGridParams} params - params
* @param {string} [params.textinstructions] - For example: Please click each image containing a ladybug
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "hcap2"
}));
/**
* @type {boolean} isGrid - only used for correctly working method overloading intellisense
*/
__publicField(this, "isGrid", true);
}
};
__name(_HCaptchaGridTask, "HCaptchaGridTask");
var HCaptchaGridTask = _HCaptchaGridTask;
// src/lib/Request/Recognition/ImageToTextTask.ts
var ImageToTextVernet;
(function(ImageToTextVernet2) {
ImageToTextVernet2[ImageToTextVernet2["GeneralV1"] = 1] = "GeneralV1";
ImageToTextVernet2[ImageToTextVernet2["GeneralV2"] = 6] = "GeneralV2";
ImageToTextVernet2[ImageToTextVernet2["Arithmetic"] = 22] = "Arithmetic";
ImageToTextVernet2[ImageToTextVernet2["Rambler"] = 12] = "Rambler";
ImageToTextVernet2[ImageToTextVernet2["GeneralYandex"] = 18] = "GeneralYandex";
ImageToTextVernet2[ImageToTextVernet2["Yandex6ch"] = 20] = "Yandex6ch";
ImageToTextVernet2[ImageToTextVernet2["VKontakte"] = 16] = "VKontakte";
ImageToTextVernet2[ImageToTextVernet2["SolveMedia"] = 14] = "SolveMedia";
ImageToTextVernet2[ImageToTextVernet2["Gibdd"] = 13] = "Gibdd";
ImageToTextVernet2[ImageToTextVernet2["OkRu"] = 9] = "OkRu";
ImageToTextVernet2[ImageToTextVernet2["WorldOfTanks"] = 17] = "WorldOfTanks";
ImageToTextVernet2[ImageToTextVernet2["MicrosoftHotmail"] = 5] = "MicrosoftHotmail";
ImageToTextVernet2[ImageToTextVernet2["GeneralCyrillic"] = 7] = "GeneralCyrillic";
})(ImageToTextVernet || (ImageToTextVernet = {}));
var _ImageToTextTask = class _ImageToTextTask extends BaseTask {
/**
* Create Image to text task
* @see {@link https://docs.cap.guru/en/apiclick/text.html}
* @param {ImageToTextParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
* @param {ImageToTextVernet} [params.vernet] - vernet for image recognition
*/
constructor({ body, vernet }) {
super({
"method": "base64"
});
/**
* @type {boolean} isString - only used for correctly working method overloading intellisense
*/
__publicField(this, "isString", true);
/**
* @param {ImageToTextVernet} vernet - vernet for image recognition
*/
__publicField(this, "vernet");
/**
* @type {string} body - Image encoded in Base64 format
*/
__publicField(this, "body");
this.body = body;
this.vernet = vernet;
}
};
__name(_ImageToTextTask, "ImageToTextTask");
var ImageToTextTask = _ImageToTextTask;
// src/lib/Request/Recognition/LinkvertiseCoordinatesTask.ts
var _LinkvertiseCoordinatesTask = class _LinkvertiseCoordinatesTask extends RecognitionBaseTask {
/**
* Create Linkvertise coordinates task. This method solves Linkvertise, with image clicks. We detect objects on the captcha and send you the coordinates for clicking.
* This task uses click='oth'
* @see {@link https://docs.cap.guru/en/apiclick/other/linkvertise.html}
* @param {LinkvertiseCoordinatesParams} params - params
* @param {string} [params.textinstructions] - For example: custom1221,Please click on the globe
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "oth"
}));
/**
* @type {boolean} isMultipleCoordinates - only used for correctly working method overloading intellisense
*/
__publicField(this, "isMultipleCoordinates", true);
}
};
__name(_LinkvertiseCoordinatesTask, "LinkvertiseCoordinatesTask");
var LinkvertiseCoordinatesTask = _LinkvertiseCoordinatesTask;
// src/lib/Request/Recognition/ReCaptchaGridTask.ts
var _ReCaptchaGridTask = class _ReCaptchaGridTask extends RecognitionBaseTask {
/**
* Create ReCaptcha grid task
* This task uses click='recap2'
* @see {@link https://docs.cap.guru/en/apiclick/recap.html}
* @param {ReCaptchaGridParams} params - params
* @param {string} [params.textinstructions] - For example: Select all images with traffic light
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "recap2"
}));
/**
* @type {boolean} isGrid - only used for correctly working method overloading intellisense
*/
__publicField(this, "isGrid", true);
}
};
__name(_ReCaptchaGridTask, "ReCaptchaGridTask");
var ReCaptchaGridTask = _ReCaptchaGridTask;
// src/lib/Request/Recognition/SeoFastCoordinatesTask.ts
var _SeoFastCoordinatesTask = class _SeoFastCoordinatesTask extends RecognitionBaseTask {
/**
* Create SeoFast coordinates task. This method solves Seo-fast/Profitcentr/Seotime, with image clicks. We detect objects on the captcha and send you the coordinates for clicking.
* This task uses click='oth'
* @see {@link https://docs.cap.guru/en/apiclick/other/seofast.html}
* @param {SeoFastCoordinatesParams} params - params
* @param {string} [params.textinstructions] - For example: custom1222,Отметьте изображения со бантиками
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "oth"
}));
/**
* @type {boolean} isMultipleCoordinates - only used for correctly working method overloading intellisense
*/
__publicField(this, "isMultipleCoordinates", true);
}
};
__name(_SeoFastCoordinatesTask, "SeoFastCoordinatesTask");
var SeoFastCoordinatesTask = _SeoFastCoordinatesTask;
// src/lib/Request/Recognition/TikTokABCTask.ts
var _TikTokABCTask = class _TikTokABCTask extends RecognitionBaseTask {
/**
* Create TikTok ABC task
* This task uses click='geetest' and textinstructions='abc'
* @see {@link https://docs.cap.guru/en/apiclick/tiktok.html}
* @param {TikTokGridParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "geetest",
"textinstructions": "abc"
}));
/**
* @type {boolean} isMultipleCoordinates - only used for correctly working method overloading intellisense
*/
__publicField(this, "isMultipleCoordinates", true);
}
};
__name(_TikTokABCTask, "TikTokABCTask");
var TikTokABCTask = _TikTokABCTask;
// src/lib/Request/Recognition/TikTokKolesoTask.ts
var _TikTokKolesoTask = class _TikTokKolesoTask extends RecognitionBaseTask {
/**
* Create TikTok Koleso task
* This task uses click='geetest' and textinstructions='koleso'
* You can use only one image (body), or body0 and body1 images for outer and inner pieces of TikTok puzzle
* @see {@link https://docs.cap.guru/en/apiclick/tiktok.html}
* @param {TikTokGridParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
* @param {string} [params.body0] - Image encoded in Base64 format
* @param {string} [params.body1] - Image encoded in Base64 format
*/
constructor(_a) {
var _b = _a, { body1, body0 } = _b, params = __objRest(_b, ["body1", "body0"]);
super(__spreadProps(__spreadValues({}, params), {
"click": "geetest",
"textinstructions": "koleso"
}));
/**
* @type {boolean} isSingleCoordinate - only used for correctly working method overloading intellisense
*/
__publicField(this, "isSingleCoordinate", true);
/**
* @type {string} body0
*/
__publicField(this, "body0");
/**
* @type {string} body1
*/
__publicField(this, "body1");
this.body0 = body0;
this.body1 = body1;
}
};
__name(_TikTokKolesoTask, "TikTokKolesoTask");
var TikTokKolesoTask = _TikTokKolesoTask;
// src/lib/Request/Recognition/TikTokPuzzleTask.ts
var _TikTokPuzzleTask = class _TikTokPuzzleTask extends GenericPuzzleTask {
/**
* Create TikTok Puzzle task
* This task uses click='geetest' and textinstructions='slider'
* @see {@link https://docs.cap.guru/en/apiclick/tiktok.html}
* @param {TikTokGridParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(params);
}
};
__name(_TikTokPuzzleTask, "TikTokPuzzleTask");
var TikTokPuzzleTask = _TikTokPuzzleTask;
// src/lib/Request/Recognition/WorldCashCoordinatesTask.ts
var _WorldCashCoordinatesTask = class _WorldCashCoordinatesTask extends RecognitionBaseTask {
/**
* Create WorldCash coordinates task. This method solves World.cash, with image clicks. We detect objects on the captcha and send you the coordinates for clicking.
* This task uses click='oth' and textinstructions='custom1224'
* @see {@link https://docs.cap.guru/en/apiclick/other/worldcash.html}
* @param {WorldCashCoordinatesParams} params - params
* @param {string} [params.body] - Image encoded in Base64 format
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"click": "oth",
"textinstructions": "custom1224"
}));
/**
* @type {boolean} isMultipleCoordinates - only used for correctly working method overloading intellisense
*/
__publicField(this, "isMultipleCoordinates", true);
}
};
__name(_WorldCashCoordinatesTask, "WorldCashCoordinatesTask");
var WorldCashCoordinatesTask = _WorldCashCoordinatesTask;
// src/lib/Request/Token/HCaptchaTask.ts
var _HCaptchaTask = class _HCaptchaTask extends BaseTask {
//
// Create HCaptchaTask
// {@link https://docs.cap.guru/en/apitoken/hcap.html}
// @param {HCaptchaParams} params - params
// @param {string} [params.sitekey] - The value of the parameter k or data-sitekey that you found in the page code. For example 93d2dffa-6cad-4031-9c00-4741a03c569d
// @param {string} [params.pageurl] - Full URL of the page where you are solving hCaptcha
// For example http://learn.captcha.guru/ln/hcaptcha /
// @param {string} [params.cookies] - Your cookies that will be used by the employee to solve the captcha.
// @param {string} [params.userAgent] - We substitute your userAgent for the employee.
// @param {string} [params.proxy] - Format: login:password@151.142.23.32:3128
// @param {string} [params.proxyType] - Your proxy type: : HTTP, HTTPS, SOCKS4, SOCKS5.
//
constructor({ sitekey, pageurl, proxy, proxyType, userAgent, cookies }) {
super({
"method": "hcaptcha"
});
//
// @type {string} sitekey - The value of the parameter k or data-sitekey that you found in the page code
// For example 93d2dffa-6cad-4031-9c00-4741a03c569d
//
__publicField(this, "sitekey");
//
// @type {string} pageurl - Full URL of the page where you are solving hCaptcha
// For example http://learn.captcha.guru/ln/hcaptcha/
//
__publicField(this, "pageurl");
/**
* @type {string} cookies - Your cookies that will be used by the employee to solve the captcha.
*/
__publicField(this, "cookies");
/**
* @type {string} userAgent - We substitute your userAgent for the employee.
*/
__publicField(this, "userAgent");
//
// @type {string} proxy - Format: login:password@151.142.23.32:3128
// More information about the proxy [here] (/en/api/proxy).
//
__publicField(this, "proxy");
/**
* @type {string} proxyType - Your proxy type: : HTTP, HTTPS, SOCKS4, SOCKS5.
*/
__publicField(this, "proxyType");
/**
* @type {boolean} isString - only used for correctly working method overloading intellisense
*/
__publicField(this, "isString", true);
this.sitekey = sitekey;
this.pageurl = pageurl;
this.proxy = proxy;
this.proxyType = proxyType;
this.userAgent = userAgent;
this.cookies = cookies;
}
};
__name(_HCaptchaTask, "HCaptchaTask");
var HCaptchaTask = _HCaptchaTask;
// src/lib/Request/Token/_ReCaptchaBaseTask.ts
var _ReCaptchaBaseTask = class _ReCaptchaBaseTask extends BaseTask {
/**
* Create ReCaptchaBaseTask
* @param {ReCaptchaBaseParams} params - params
* @param {string} [params.googlekey] - The value of the parameter k or data-sitekey that you found in the page code. For example 6le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-
* @param {string} [params.pageurl] - Full URL of the page where you are solving reCAPTCHA
* @param {string} [params.data-s] - The value of the data-s parameter found on the page. Relevant for Google search
* @param {string} [params.cookies] - Your cookies that will be used by the employee to solve the captcha.
* @param {string} [params.userAgent] - We substitute your userAgent for the employee.
* @param {string} [params.proxy] - Format: login:password@151.142.23.32:3128
* @param {string} [params.proxyType] - Your proxy type: : HTTP, HTTPS, SOCKS4, SOCKS5.
*/
constructor({ googlekey, pageurl, proxy, proxyType, userAgent, cookies, "data-s": dataS, version }) {
super({
"method": "userrecaptcha"
});
//
// @type {string} googlekey - The value of the parameter k or data-sitekey that you found in the page code
// For example 6le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-
//
__publicField(this, "googlekey");
//
// @type {string} pageurl - Full URL of the page where you are solving reCAPTCHA Base
// For example https://www.google.com/recaptcha/api2/demo
//
__publicField(this, "pageurl");
/**
* @type {string} data-s - The value of the data-s parameter found on the page. Relevant for Google search and other Google services.
*/
__publicField(this, "data-s");
/**
* @type {string} cookies - Your cookies that will be used by the employee to solve the captcha.
*/
__publicField(this, "cookies");
/**
* @type {string} userAgent - We substitute your userAgent for the employee.
*/
__publicField(this, "userAgent");
//
// @type {string} proxy - Format: login:password@151.142.23.32:3128
// More information about the proxy [here] (/en/api/proxy).
//
__publicField(this, "proxy");
/**
* @type {string} proxyType - Your proxy type: : HTTP, HTTPS, SOCKS4, SOCKS5.
*/
__publicField(this, "proxyType");
/**
* @type {number} version - Recaptcha version
*/
__publicField(this, "version");
/**
* @type {boolean} isString - only used for correctly working method overloading intellisense
*/
__publicField(this, "isString", true);
this.googlekey = googlekey;
this.pageurl = pageurl;
this["data-s"] = dataS;
this.proxy = proxy;
this.proxyType = proxyType;
this.userAgent = userAgent;
this.cookies = cookies;
this.version = version;
}
};
__name(_ReCaptchaBaseTask, "ReCaptchaBaseTask");
var ReCaptchaBaseTask = _ReCaptchaBaseTask;
// src/lib/Request/Token/ReCaptchaV2Task.ts
var _ReCaptchaV2Task = class _ReCaptchaV2Task extends ReCaptchaBaseTask {
/**
* Create ReCaptchaV2Task
* @see {@link https://docs.cap.guru/en/apitoken/recap2.html}
* @param {ReCaptchaV2Params} params - params
* @param {string} [params.googlekey] - The value of the parameter k or data-sitekey that you found in the page code. For example 6le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-
* @param {string} [params.pageurl] - Full URL of the page where you are solving reCAPTCHA V2
* @param {string} [params.data-s] - The value of the data-s parameter found on the page. Relevant for Google search
* @param {string} [params.cookies] - Your cookies that will be used by the employee to solve the captcha.
* @param {string} [params.userAgent] - We substitute your userAgent for the employee.
* @param {string} [params.proxy] - Format: login:password@151.142.23.32:3128
* @param {string} [params.proxyType] - Your proxy type: : HTTP, HTTPS, SOCKS4, SOCKS5.
*/
constructor(params) {
super(__spreadProps(__spreadValues({}, params), {
"version": "v2"
}));
}
};
__name(_ReCaptchaV2Task, "ReCaptchaV2Task");
var ReCaptchaV2Task = _ReCaptchaV2Task;
// src/lib/Request/Token/ReCaptchaV3Task.ts
var _ReCaptchaV3Task = class _ReCaptchaV3Task extends ReCaptchaBaseTask {
/**
* Create ReCaptchaV3Task
* @see {@link https://docs.cap.guru/en/apitoken/recap3.html}
* @param {ReCaptchaV3Params} params - params
* @param {string} [params.googlekey] - The value of the parameter k or data-sitekey that you found in the page code. For example 6le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-
* @param {string} [params.pageurl] - Full URL of the page where you are solving reCAPTCHA V3
* @param {string} [params.min_score] - Required rating value (score). At the moment, it is difficult to get a token with a score higher than 0.1
* @param {string} [params.cookies] - Your cookies that will be used by the employee to solve the captcha.
* @param {string} [params.userAgent] - We substitute your userAgent for the employee.
* @param {string} [params.proxy] - Format: login:password@151.142.23.32:3128
* @param {string} [params.proxyType] - Your proxy type: : HTTP, HTTPS, SOCKS4, SOCKS5.
*/
constructor(params) {
const _a = params, { min_score } = _a, _params = __objRest(_a, ["min_score"]);
super(__spreadProps(__spreadValues({}, _params), {
"version": "v3"
}));
/**
* @type {number} min_score - Required rating value (score). At the moment, it is difficult to get a token with a score higher than 0.1
*/
__publicField(this, "min_score");
this.min_score = min_score;
}
};
__name(_ReCaptchaV3Task, "ReCaptchaV3Task");
var ReCaptchaV3Task = _ReCaptchaV3Task;
// src/lib/Request/Token/TurnstileTask.ts
var _TurnstileTask = class _TurnstileTask extends BaseTask {
//
// Create TurnstileTaskTask
// {@link https://docs.cap.guru/en/apitoken/turnstile.html}
// @param {TurnstileTaskParams} params - params
// @param {string} [params.sitekey] - The value of the data-sitekey parameter you found in the page code
// For example 1x00000000000000000000AA
// @param {string} [params.pageurl] - URL of the page you are solving Cloudflare Turnstile
// For example https://react-turnstile.vercel.app/basic
//
constructor({ pageurl, sitekey }) {
super({
"method": "turnstile"
});
//
// @type {string} pageurl - URL of the page you are solving Cloudflare Turnstile
// For example https://react-turnstile.vercel.app/basic
//
__publicField(this, "pageurl");
//
// @type {string} sitekey - The value of the data-sitekey parameter you found in the page code
// For example 1x00000000000000000000AA
//
__publicField(this, "sitekey");
/**
* @type {boolean} isString - only used for correctly working method overloading intellisense
*/
__publicField(this, "isString", true);
this.sitekey = sitekey;
this.pageurl = pageurl;
}
};
__name(_TurnstileTask, "TurnstileTask");
var TurnstileTask = _TurnstileTask;
exports.AmazonCarPathTask = AmazonCarPathTask; exports.AmazonPuzzleTask = AmazonPuzzleTask; exports.BinanceGridTask = BinanceGridTask; exports.BinancePuzzleTask = BinancePuzzleTask; exports.BuxMoneyCoordinatesTask = BuxMoneyCoordinatesTask; exports.CapGuru = CapGuru; exports.FunCaptchaGridTask = FunCaptchaGridTask; exports.GeeTestPuzzleTask = GeeTestPuzzleTask; exports.GenericPuzzleTask = GenericPuzzleTask; exports.HCaptchaCoordinatesTask = HCaptchaCoordinatesTask; exports.HCaptchaGridTask = HCaptchaGridTask; exports.HCaptchaTask = HCaptchaTask; exports.ImageToTextTask = ImageToTextTask; exports.LinkvertiseCoordinatesTask = LinkvertiseCoordinatesTask; exports.ReCaptchaGridTask = ReCaptchaGridTask; exports.ReCaptchaV2Task = ReCaptchaV2Task; exports.ReCaptchaV3Task = ReCaptchaV3Task; exports.SeoFastCoordinatesTask = SeoFastCoordinatesTask; exports.TikTokABCTask = TikTokABCTask; exports.TikTokKolesoTask = TikTokKolesoTask; exports.TikTokPuzzleTask = TikTokPuzzleTask; exports.TurnstileTask = TurnstileTask; exports.WorldCashCoordinatesTask = WorldCashCoordinatesTask;
//# sourceMappingURL=index.cjs.map