UNPKG

@captcha-libs/twocaptcha

Version:

TwoCaptcha NodeJS client, captcha recognition service

961 lines (935 loc) 151 kB
import { CaptchaClient } from '@captcha-libs/captcha-client'; interface CaptchaClientParams { "clientKey": string; "pollingInterval"?: number; "timeout"?: number; } interface TwoCaptchaErrorResponse { "errorCode": string; "errorDescription": string; "errorId": number; } interface TwoCaptchaSuccessResponse { "errorId": number; "taskId": number; } interface TwoCaptchaReportTaskSuccessResponse { "errorId": number; "status": string; } type TwoCaptchaCreateTaskResponse = TwoCaptchaErrorResponse | TwoCaptchaSuccessResponse; declare const _TaskTypes: readonly ["ImageToTextTask", "TextCaptchaTask", "RotateTask", "CoordinatesTask", "GridTask", "DrawAroundTask", "BoundingBoxTask", "AudioTask", "RecaptchaV2TaskProxyless", "RecaptchaV2Task", "RecaptchaV2EnterpriseTask", "RecaptchaV2EnterpriseTaskProxyless", "RecaptchaV3TaskProxyless", "HCaptchaTask", "HCaptchaTaskProxyless", "FunCaptchaTask", "FunCaptchaTaskProxyless", "GeeTestTask", "GeeTestTaskProxyless", "TurnstileTask", "TurnstileTaskProxyless", "CapyTask", "CapyTaskProxyless", "KeyCaptchaTask", "KeyCaptchaTaskProxyless", "LeminTask", "LeminTaskProxyless", "AmazonTask", "AmazonTaskProxyless", "AntiCyberSiAraTask", "AntiCyberSiAraTaskProxyless", "MtCaptchaTask", "MtCaptchaTaskProxyless", "CutCaptchaTask", "CutCaptchaTaskProxyless", "DataDomeSliderTask", "FriendlyCaptchaTask", "FriendlyCaptchaTaskProxyless", "TencentTask", "TencentTaskProxyless", "AtbCaptchaTask", "AtbCaptchaTaskProxyless"]; type TaskTypes = typeof _TaskTypes[number]; interface BaseParams { "type": TaskTypes; } type ProxyTypes = "http" | "socks4" | "socks5"; type ProxyCredentials = { "proxyAddress": string; "proxyLogin"?: string; "proxyPassword"?: string; "proxyPort": number; "proxyType": ProxyTypes; }; type ProxyRequiredTaskParams<T> = ProxyCredentials & T; type ProxylessTaskParams<T> = Omit<T, keyof ProxyCredentials>; /** * @type {_IsTaskType} _IsTaskType - Only used for correct method overloading intellisense */ type _IsTaskType = { readonly [type in TaskTypes as `_is${type}`]?: boolean; }; declare abstract class BaseTask { /** * @type {TaskTypes} type - task type */ protected type: TaskTypes; constructor({ type }: BaseParams); } type TextCaptchaParams = Omit<BaseParams, "type"> & { "comment": string; }; declare class TextCaptchaTask extends BaseTask implements _IsTaskType, TextCaptchaParams { /** * @type {string} comment - Text with a question you need to answer. */ comment: string; /** * @type {boolean} _isTextCaptchaTask - Only used for correct method overloading intellisense */ readonly _isTextCaptchaTask: _IsTaskType["_isTextCaptchaTask"]; /** * Create TextCaptchaTask * @see {@link https://2captcha.com/api-docs/text} * @param {Object} params - TextCaptchaParams * @param {string} [params.comment] - Text with a question you need to answer. */ constructor({ comment }: TextCaptchaParams); } type RotateTaskParams = Omit<BaseParams, "type"> & { "angle"?: number; "body": string; "comment"?: string; "imgInstructions"?: string; }; /** * The method is used to solve captchas where you need to rotate an object to place it properly. Returns the required rotation angle. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/rotate} */ declare class RotateTask extends BaseTask implements _IsTaskType, RotateTaskParams { /** * @type {string} comment - A comment will be shown to workers to help them to solve the captcha properly */ comment?: string; /** * @type {string} body - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported */ body: string; /** * @type {number} angle - One step rotation angle. You can count how many steps are required to rotate the image 360 degrees and then divide 360 by this count to get the angle value */ angle?: number; /** * @type {string} imgInstructions - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ imgInstructions?: string; /** * @type {boolean} _isRotateTask - Only used for correct method overloading intellisense */ readonly _isRotateTask: _IsTaskType["_isRotateTask"]; /** * Create RotateTask * @see {@link https://2captcha.com/api-docs/rotate} * @param {Object} params - RotateTaskParams * @param {string} [params.body] - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported * @param {string=} [params.comment] - A comment will be shown to workers to help them to solve the captcha properly * @param {string=} [params.angle] - One step rotation angle. You can count how many steps are required to rotate the image 360 degrees and then divide 360 by this count to get the angle value * @type {string} [params.imgInstructions] - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ constructor({ body, comment, angle, imgInstructions }: RotateTaskParams); } declare enum NumericOptions { "none" = 0, "onlyNumbers" = 1, "onlyLetters" = 2, "numbersOrLetters" = 3, "numbersAndLetters" = 4 } type ImageToTextParams = Omit<BaseParams, "type"> & { "body": string; "case"?: boolean; "comment"?: string; "imgInstructions"?: string; "math"?: boolean; "maxLength"?: number; "minLength"?: number; "numeric"?: NumericOptions; "phrase"?: boolean; }; /** * Normal CAPTCHA is an image that contains distored but human-readable text. To solve the captcha user have to type the text from the image. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/normal-captcha} */ declare class ImageToTextTask extends BaseTask implements _IsTaskType, ImageToTextParams { /** * @type {string} body - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported */ body: string; /** * @type {string} case - Case sensitive or not */ case?: boolean; /** * @type {string} comment - A comment will be shown to workers to help them to solve the captcha properly */ comment?: string; /** * @type {string} imgInstructions - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. */ imgInstructions?: string; /** * @type {string} math - Captcha requires calculation */ math?: boolean; /** * @type {number} maxLength - defines maximal answer length */ maxLength?: number; /** * @type {number} maxLength - defines minimal answer length */ minLength?: number; /** * @type {number} maxLength - Numeric preference */ numeric?: NumericOptions; /** * @type {number} maxLength - The answer should contain at least two words separated by space. */ phrase?: boolean; /** * @type {boolean} _isImageToTextTask - Only used for correct method overloading intellisense */ readonly _isImageToTextTask: _IsTaskType["_isImageToTextTask"]; /** * Create ImageToTextTask * @see {@link https://2captcha.com/api-docs/normal-captcha} * @param {Object} params - ImageToTextParams * @param {string} [params.body] - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported * @param {boolean=} [params.case] - Case sensitive or not * @param {string=} [params.comment] - A comment will be shown to workers to help them to solve the captcha properly * @param {string=} [params.imgInstructions] - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. * @param {boolean=} [params.math] - captcha requires calculation * @param {number=} [params.maxLength] - defines maximal answer length * @param {number=} [params.minLength] - defines minimal answer length * @param {NumericOptions=} [params.numeric] - Numeric preference * @param {boolean=} [params.phrase] - The answer should contain at least two words separated by space. */ constructor({ body, "case": _case, comment, imgInstructions, math, maxLength, minLength, numeric, phrase }: ImageToTextParams); } type GridTaskParams = { "body": string; "columns"?: number; "comment"?: string; "imgInstructions"?: string; "rows"?: number; }; type GridTaskParamsCommentParams = GridTaskParams & { "comment": string; }; type GridTaskParamsImgInstructionsParams = GridTaskParams & { "imgInstructions": string; }; /** * The method can be used to bypass tasks where a grid is applied to an image and you need to click on grid tiles, like reCAPTCHA or hCaptcha images. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/grid} */ declare class GridTask extends BaseTask implements _IsTaskType, GridTaskParams { /** * @type {string} comment - A comment will be shown to workers to help them to solve the captcha properly */ comment?: string; /** * @type {string} body - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported */ body: string; /** * @type {string} imgInstructions - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ imgInstructions?: string; /** * @type {number} rows - Number of grid rows */ rows?: number; /** * @type {number} columns - Number of grid columns */ columns?: number; /** * @type {boolean} _isGridTask - Only used for correct method overloading intellisense */ readonly _isGridTask: _IsTaskType["_isGridTask"]; /** * Create GridTask * @see {@link https://2captcha.com/api-docs/grid} * @param {Object} params - GridTaskParams * @param {string} [params.body] - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported * @param {string=} [params.comment] - A comment will be shown to workers to help them to solve the captcha properly * @param {string} [params.imgInstructions] - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB * @param {number} [params.rows] - Number of grid rows * @param {number} [params.columns] - Number of grid columns */ constructor({ body, comment, imgInstructions, columns, rows }: GridTaskParamsCommentParams | GridTaskParamsImgInstructionsParams); } interface DrawAroundTaskParams { "body": string; "comment"?: string; "imgInstructions"?: string; } type DrawAroundTaskCommentParam = DrawAroundTaskParams & { "comment": string; }; type DrawAroundTaskImgInstructionsParam = DrawAroundTaskParams & { "imgInstructions": string; }; /** * The method can be used to bypass tasks where you need to draw a line around a specific object shown on an image. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/draw-around} */ declare class DrawAroundTask extends BaseTask implements _IsTaskType, DrawAroundTaskParams { /** * @type {string} comment - A comment will be shown to workers to help them to solve the captcha properly */ comment?: string; /** * @type {string} body - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported */ body: string; /** * @type {string} imgInstructions - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ imgInstructions?: string; /** * @type {boolean} _isDrawAroundTask - Only used for correct method overloading intellisense */ readonly _isDrawAroundTask: _IsTaskType["_isDrawAroundTask"]; /** * Create DrawAroundTask * @see {@link https://2captcha.com/api-docs/draw-around} * @param {Object} params - DrawAroundTaskParams * @param {string} [params.body] - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported * @param {string=} [params.comment] - A comment will be shown to workers to help them to solve the captcha properly * @type {string} [params.imgInstructions] - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ constructor({ body, comment, imgInstructions }: DrawAroundTaskCommentParam | DrawAroundTaskImgInstructionsParam); } type CoordinatesTaskParams = { "body": string; "comment"?: string; "imgInstructions"?: string; }; /** * The method can be used to bypass tasks where you need to click on some points of an image. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/coordinates} */ declare class CoordinatesTask extends BaseTask implements _IsTaskType, CoordinatesTaskParams { /** * @type {string} comment - A comment will be shown to workers to help them to solve the captcha properly */ comment?: string; /** * @type {string} body - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported */ body: string; /** * @type {string} imgInstructions - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ imgInstructions?: string; /** * @type {boolean} _isCoordinatesTask - Only used for correct method overloading intellisense */ readonly _isCoordinatesTask: _IsTaskType["_isCoordinatesTask"]; /** * Create CoordinatesTask * @see {@link https://2captcha.com/api-docs/coordinates} * @param {Object} params - CoordinatesTaskParams * @param {string} [params.body] - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported * @param {string=} [params.comment] - A comment will be shown to workers to help them to solve the captcha properly * @param {string} [params.imgInstructions] - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ constructor({ body, comment, imgInstructions }: CoordinatesTaskParams); } interface BoundingBoxTaskParams { "body": string; "comment"?: string; "imgInstructions"?: string; } type BoundingBoxTaskCommentParam = BoundingBoxTaskParams & { "comment": string; }; type BoundingBoxTaskImgInstructionsParam = BoundingBoxTaskParams & { "imgInstructions": string; }; /** * The method can be used to solve tasks where you need to select a specific object or draw a box around an object shown on an image. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/bounding-box} */ declare class BoundingBoxTask extends BaseTask implements _IsTaskType, BoundingBoxTaskParams { /** * @type {string} comment - A comment will be shown to workers to help them to solve the captcha properly */ comment?: string; /** * @type {string} body - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported */ body: string; /** * @type {string} imgInstructions - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ imgInstructions?: string; /** * @type {boolean} _isBoundingBoxTask - Only used for correct method overloading intellisense */ readonly _isBoundingBoxTask: _IsTaskType["_isBoundingBoxTask"]; /** * Create BoundingBoxTask * @see {@link https://2captcha.com/api-docs/bounding-box} * @param {Object} params - BoundingBoxTaskParams * @param {string} [params.body] - Image encoded into Base64 format. Data-URI format (containing data:content/type prefix) is also supported * @param {string=} [params.comment] - A comment will be shown to workers to help them to solve the captcha properly * @type {string=} [params.imgInstructions] - An optional image with instruction that will be shown to workers. Image should be encoded into Base64 format. Max file size: 100 kB */ constructor({ body, comment, imgInstructions }: BoundingBoxTaskCommentParam | BoundingBoxTaskImgInstructionsParam); } type AudioLangs = "de" | "el" | "en" | "fr" | "pt" | "ru"; type AudioTaskParams = Omit<BaseParams, "type"> & { "body": string; "lang": AudioLangs; }; /** * We provide a speech recognition method that allows you to convert an audio record to text. The method can be used to bypass audio captchas or to recognize any audio record. * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/audio} */ declare class AudioTask extends BaseTask implements _IsTaskType, AudioTaskParams { /** * @type {string} body - Base64 encoded audio file in mp3 format */ body: string; /** * @type {string} lang - The language of audio record. Supported languages are: en, fr, de, el, pt, ru */ lang: AudioLangs; /** * @type {boolean} _isAudioTask - Only used for correct method overloading intellisense */ readonly _isAudioTask: _IsTaskType["_isAudioTask"]; /** * Create AudioTask * @see {@link https://2captcha.com/api-docs/audio} * @param {Object} params - AudioTaskParams * @param {string} [params.body] - Base64 encoded audio file in mp3 format * @param {string} [params.lang] - The language of audio record. Supported languages are: en, fr, de, el, pt, ru */ constructor({ lang, body }: AudioTaskParams); } type TencentTaskBaseParams = Partial<ProxyCredentials> & { "appId": string; "websiteURL": string; }; /** * Base class for TencentTask * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/tencent} */ declare abstract class TencentTaskBase extends BaseTask implements TencentTaskBaseParams { /** * @type {string} websiteURL - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users */ websiteURL: string; /** * @type {string} appId - The TencentTask sitekey value found in the page code. */ appId: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyTypes; proxy?: string; /** * TencentTaskBase * @see {@link https://2captcha.com/api-docs/tencent} * @param {Object} params - TencentTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.appId] - The TencentTask sitekey value found in the page code. * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor({ appId, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: TencentTaskBaseParams, type: TaskTypes); } type TencentTaskProxylessParams = ProxylessTaskParams<TencentTaskBaseParams>; /** * Token-based method to bypass Tencent captcha. * @extends {CapyTaskBase} * @see {@link https://2captcha.com/api-docs/tencent} */ declare class TencentTaskProxyless extends TencentTaskBase implements _IsTaskType { /** * @type {boolean} _isTencentTaskProxyless - Only used for correct method overloading intellisense */ readonly _isTencentTaskProxyless: _IsTaskType["_isTencentTaskProxyless"]; /** * Create TencentTaskProxyless * @see {@link https://2captcha.com/api-docs/tencent} * @param {Object} params - TencentTaskProxylessParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.appId] - The TencentTask sitekey value found in the page code. */ constructor(params: TencentTaskProxylessParams); } type TencentTaskParams = ProxyRequiredTaskParams<TencentTaskBaseParams>; /** * Token-based method to bypass Tencent captcha. * @extends {TencentTaskBase} * @see {@link https://2captcha.com/api-docs/tencent} */ declare class TencentTask extends TencentTaskBase implements _IsTaskType { /** * @type {boolean} _isTencentTask - Only used for correct method overloading intellisense */ readonly _isTencentTask: _IsTaskType["_isTencentTask"]; /** * Create TencentTask * @see {@link https://2captcha.com/api-docs/tencent} * @param {Object} params - TencentTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.appId] - The TencentTask sitekey value found in the page code. * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor(params: TencentTaskParams); } type AtbCaptchaTaskBaseParams = Partial<ProxyCredentials> & { "apiServer": string; "appId": string; "websiteURL": string; }; /** * Base class for AtbCaptchaTask * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/atb-captcha} */ declare abstract class AtbCaptchaTaskBase extends BaseTask implements AtbCaptchaTaskBaseParams { /** * @type {string} websiteURL - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users */ websiteURL: string; /** * @type {string} appId - The value of appId parameter in the website source code. */ appId: string; /** * @type {string} apiServer - The value of apiServer parameter in the website source code. */ apiServer: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyTypes; proxy?: string; /** * AtbCaptchaTaskBase * @see {@link https://2captcha.com/api-docs/atb-captcha} * @param {Object} params - AtbCaptchaTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.appId] - The value of appId parameter in the website source code. * @param {string} [params.apiServer] - The value of apiServer parameter in the website source code. * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor({ appId, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword, apiServer }: AtbCaptchaTaskBaseParams, type: TaskTypes); } type AtbCaptchaTaskProxylessParams = ProxylessTaskParams<AtbCaptchaTaskBaseParams>; /** * Token-based method to bypass Tencent captcha. * @extends {AtbCaptchaTaskProxylessBase} * @see {@link https://2captcha.com/api-docs/atb-captcha} */ declare class AtbCaptchaTaskProxyless extends AtbCaptchaTaskBase implements _IsTaskType { /** * @type {boolean} _isAtbCaptchaTaskProxyless - Only used for correct method overloading intellisense */ readonly _isAtbCaptchaTaskProxyless: _IsTaskType["_isAtbCaptchaTaskProxyless"]; /** * Create AtbCaptchaTaskProxyless * @see {@link https://2captcha.com/api-docs/atb-captcha} * @param {Object} params - AtbCaptchaTaskProxylessParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.appId] - The value of appId parameter in the website source code. * @param {string} [params.apiServer] - The value of apiServer parameter in the website source code. */ constructor(params: AtbCaptchaTaskProxylessParams); } type AtbCaptchaTaskParams = ProxyRequiredTaskParams<AtbCaptchaTaskBaseParams>; /** * Token-based method to bypass Tencent captcha. * @extends {AtbCaptchaTaskBase} * @see {@link https://2captcha.com/api-docs/atb-captcha} */ declare class AtbCaptchaTask extends AtbCaptchaTaskBase implements _IsTaskType { /** * @type {boolean} _isAtbCaptchaTask - Only used for correct method overloading intellisense */ readonly _isAtbCaptchaTask: _IsTaskType["_isAtbCaptchaTask"]; /** * Create AtbCaptchaTask * @see {@link https://2captcha.com/api-docs/atb-captcha} * @param {Object} params - AtbCaptchaTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.appId] - The value of appId parameter in the website source code. * @param {string} [params.apiServer] - The value of apiServer parameter in the website source code. * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor(params: AtbCaptchaTaskParams); } type CutCaptchaTaskBaseParams = Partial<ProxyCredentials> & { "apiKey": string; "miseryKey": string; "websiteURL": string; }; /** * Base class for CutCaptchaTask * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/cutcaptcha} */ declare abstract class CutCaptchaTaskBase extends BaseTask implements CutCaptchaTaskBaseParams { /** * @type {string} websiteURL - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users */ websiteURL: string; /** * @type {string} miseryKey - The value of CUTCAPTCHA_MISERY_KEY variable defined on page. */ miseryKey: string; /** * @type {string} apiKey - The value of data-apikey attribute of iframe's body. Also the name of javascript file included on the page */ apiKey: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyTypes; /** * CutCaptchaTaskBase * @see {@link https://2captcha.com/api-docs/cutcaptcha} * @param {Object} params - CutCaptchaTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.miseryKey] - The value of CUTCAPTCHA_MISERY_KEY variable defined on page. * @param {string} [params.apiKey] - The value of data-apikey attribute of iframe's body. Also the name of javascript file included on the page * @param {string} [params.userAgent] - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor({ miseryKey, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword, apiKey }: CutCaptchaTaskBaseParams, type: TaskTypes); } type CutCaptchaTaskProxylessParams = ProxylessTaskParams<CutCaptchaTaskBaseParams>; /** * Token-based method to bypass Friendly Captcha. * @extends {CutCaptchaTaskBase} * @see {@link https://2captcha.com/api-docs/cutcaptcha} */ declare class CutCaptchaTaskProxyless extends CutCaptchaTaskBase implements _IsTaskType { /** * @type {boolean} _isCutCaptchaTask - Only used for correct method overloading intellisense */ readonly _isCutCaptchaTaskProxyless: _IsTaskType["_isCutCaptchaTaskProxyless"]; /** * Create CutCaptchaTaskProxyless * @see {@link https://2captcha.com/api-docs/cutcaptcha} * @param {Object} params - CutCaptchaTaskProxylessParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.miseryKey] - The value of CUTCAPTCHA_MISERY_KEY variable defined on page. * @param {string} [params.apiKey] - The value of data-apikey attribute of iframe's body. Also the name of javascript file included on the page */ constructor(params: CutCaptchaTaskProxylessParams); } type CutCaptchaTaskParams = ProxyRequiredTaskParams<CutCaptchaTaskBaseParams>; /** * Token-based method to bypass Friendly Captcha. * @extends {CutCaptchaTaskBase} * @see {@link https://2captcha.com/api-docs/cutcaptcha} */ declare class CutCaptchaTask extends CutCaptchaTaskBase implements _IsTaskType { /** * @type {boolean} _isCutCaptchaTask - Only used for correct method overloading intellisense */ readonly _isCutCaptchaTask: _IsTaskType["_isCutCaptchaTask"]; /** * Create CutCaptchaTask * @see {@link https://2captcha.com/api-docs/cutcaptcha} * @param {Object} params - CutCaptchaTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.miseryKey] - The value of CUTCAPTCHA_MISERY_KEY variable defined on page. * @param {string} [params.apiKey] - The value of data-apikey attribute of iframe's body. Also the name of javascript file included on the page * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor(params: CutCaptchaTaskParams); } type TurnstileTaskBaseParams = Partial<ProxyCredentials> & { "action"?: string; "data"?: string; "pagedata"?: string; "userAgent": string; "websiteKey": string; "websiteURL": string; }; /** * Base class for TurnstileTask * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/cloudflare-turnstile} */ declare abstract class TurnstileTaskBase extends BaseTask implements TurnstileTaskBaseParams { /** * @type {string} websiteURL - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users */ websiteURL: string; /** * @type {string} websiteKey - Turnstile sitekey. Can be found inside data-sitekey property of the Turnstile div element */ websiteKey: string; /** * @type {string} action - Required for Cloudflare Challenge pages. The value of action parameter of turnstile.render call */ action?: string; /** * @type {string} data - Required for Cloudflare Challenge pages. The value of cData parameter of turnstile.render call */ data?: string; /** * @type {string} pagedata - Required for Cloudflare Challenge pages. The value of chlPageData parameter of turnstile.render call */ pagedata?: string; /** * @type {string} userAgent - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents */ userAgent: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyTypes; /** * TurnstileTaskBase * @see {@link https://2captcha.com/api-docs/cloudflare-turnstile} * @param {Object} params - TurnstileTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - Turnstile sitekey. Can be found inside data-sitekey property of the Turnstile div element * @param {string} [params.actions] - Required for Cloudflare Challenge pages. The value of action parameter of turnstile.render call * @param {string} [params.data] - Required for Cloudflare Challenge pages. The value of cData parameter of turnstile.render call * @param {string} [params.pagedata] - Required for Cloudflare Challenge pages. The value of chlPageData parameter of turnstile.render call * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor({ websiteKey, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword, userAgent, pagedata, data, action }: TurnstileTaskBaseParams, type: TaskTypes); } type TurnstileTaskProxylessParams = ProxylessTaskParams<TurnstileTaskBaseParams>; /** * Token-based method to bypass Cloudflare Turnstile. Both the standalone captcha and challenge mode are supported. * @extends {TurnstileTaskBase} * @see {@link https://2captcha.com/api-docs/cloudflare-turnstile} */ declare class TurnstileTaskProxyless extends TurnstileTaskBase implements _IsTaskType { /** * @type {boolean} _isTurnstileTaskProxyless - Only used for correct method overloading intellisense */ readonly _isTurnstileTaskProxyless: _IsTaskType["_isTurnstileTaskProxyless"]; /** * Create TurnstileTaskProxyless * @see {@link https://2captcha.com/api-docs/cloudflare-turnstile} * @param {Object} params - TurnstileTaskProxylessParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - Turnstile sitekey. Can be found inside data-sitekey property of the Turnstile div element * @param {string} [params.actions] - Required for Cloudflare Challenge pages. The value of action parameter of turnstile.render call * @param {string} [params.data] - Required for Cloudflare Challenge pages. The value of cData parameter of turnstile.render call * @param {string} [params.pagedata] - Required for Cloudflare Challenge pages. The value of chlPageData parameter of turnstile.render call */ constructor(params: TurnstileTaskProxylessParams); } type TurnstileTaskParams = ProxyRequiredTaskParams<TurnstileTaskBaseParams>; /** * Token-based method to bypass Cloudflare Turnstile. Both the standalone captcha and challenge mode are supported. * @extends {TurnstileTaskBase} * @see {@link https://2captcha.com/api-docs/cloudflare-turnstile} */ declare class TurnstileTask extends TurnstileTaskBase implements _IsTaskType { /** * @type {boolean} _isTurnstileTask - Only used for correct method overloading intellisense */ readonly _isTurnstileTask: _IsTaskType["_isTurnstileTask"]; /** * Create TurnstileTask * @see {@link https://2captcha.com/api-docs/cloudflare-turnstile} * @param {Object} params - TurnstileTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - Turnstile sitekey. Can be found inside data-sitekey property of the Turnstile div element * @param {string} [params.actions] - Required for Cloudflare Challenge pages. The value of action parameter of turnstile.render call * @param {string} [params.data] - Required for Cloudflare Challenge pages. The value of cData parameter of turnstile.render call * @param {string} [params.pagedata] - Required for Cloudflare Challenge pages. The value of chlPageData parameter of turnstile.render call * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port */ constructor(params: TurnstileTaskParams); } type RecaptchaV2TaskBaseParams = Partial<ProxyCredentials> & { "apiDomain"?: string; "cookies"?: string; "isInvisible"?: boolean; "recaptchaDataSValue"?: string; "userAgent"?: string; "websiteKey": string; "websiteURL": string; }; /** * Base class for Recaptcha V2 * @extends {BaseTask} * @see {@link https://2captcha.com/api-docs/recaptcha-v2} */ declare abstract class RecaptchaV2TaskBase extends BaseTask implements RecaptchaV2TaskBaseParams { /** * @type {string} cookies - Your cookies will be set in a browser of our worker. Suitable for captcha on Google services. The format is: key1=val1; key2=val2 */ cookies?: string; /** * @type {string} apiDomain - Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com */ apiDomain?: string; /** * @type {string} recaptchaDataSValue - The value of data-s parameter. Can be required to bypass the captcha on Google services */ recaptchaDataSValue?: string; /** * @type {boolean} isInvisible - Pass true for Invisible version of reCAPTCHA - a case when you don't see the checkbox, but the challenge appears. Mostly used with a callback function */ isInvisible?: boolean; /** * @type {string} userAgent - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents */ userAgent?: string; /** * @type {string} websiteURL - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users */ websiteURL: string; /** * @type {string} websiteKey - reCAPTCHA sitekey. Can be found inside data-sitekey property of the reCAPTCHA div element or inside k parameter of the requests to reCAPTHCHA API. You can also use the script to find the value */ websiteKey: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyTypes; /** * RecaptchaV2TaskBase * @see {@link https://2captcha.com/api-docs/recaptcha-v2} * @param {Object} params - RecaptchaV2TaskBaseParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - reCAPTCHA sitekey. Can be found inside data-sitekey property of the reCAPTCHA div element or inside k parameter of the requests to reCAPTHCHA API. You can also use the script to find the value * @param {string} [params.userAgent] - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents * @param {boolean}[params.isInvisible] - Pass true for Invisible version of reCAPTCHA - a case when you don't see the checkbox, but the challenge appears. Mostly used with a callback function * @param {string} [params.recaptchaDataSValue] - The value of data-s parameter. Can be required to bypass the captcha on Google services * @param {string} [params.apiDomain] - Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com * @param {string} [params.cookies] - Your cookies will be set in a browser of our worker. Suitable for captcha on Google services. The format is: key1=val1; key2=val2 * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port * */ constructor({ websiteKey, websiteURL, userAgent, isInvisible, recaptchaDataSValue, apiDomain, cookies, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: RecaptchaV2TaskBaseParams, type: TaskTypes); } interface _RecaptchaV2EnterpriseTaskParams { "enterprisePayload"?: Record<string, string>; } type RecaptchaV2EnterpriseTaskParams = _RecaptchaV2EnterpriseTaskParams & ProxyRequiredTaskParams<RecaptchaV2TaskBaseParams>; /** * Token-based method for automated solving of reCAPTCHA V2. * @extends {RecaptchaV2TaskBase} * @see {@link https://2captcha.com/api-docs/recaptcha-v2-enterprise} */ declare class RecaptchaV2EnterpriseTask extends RecaptchaV2TaskBase implements _RecaptchaV2EnterpriseTaskParams, _IsTaskType { /** * @type {boolean} _isRecaptchaV2EnterpriseTask - Only used for correct method overloading intellisense */ readonly _isRecaptchaV2EnterpriseTask: _IsTaskType["_isRecaptchaV2EnterpriseTask"]; /** * @type {string} enterprisePayload - Additional parameters passed to grecaptcha.enterprise.render call. For example, there can be an object containing s value */ enterprisePayload?: Record<string, string>; /** * Create RecaptchaV2EnterpriseTask * @see {@link https://2captcha.com/api-docs/recaptcha-v2-enterprise} * @param {Object} params - RecaptchaV2EnterpriseTaskParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - reCAPTCHA sitekey. Can be found inside data-sitekey property of the reCAPTCHA div element or inside k parameter of the requests to reCAPTHCHA API. You can also use the script to find the value * @param {string} [params.userAgent] - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents * @param {boolean}[params.isInvisible] - Pass true for Invisible version of reCAPTCHA - a case when you don't see the checkbox, but the challenge appears. Mostly used with a callback function * @param {string} [params.recaptchaDataSValue] - The value of data-s parameter. Can be required to bypass the captcha on Google services * @param {string} [params.enterprisePayload] - Additional parameters passed to grecaptcha.enterprise.render call. For example, there can be an object containing s value * @param {string} [params.apiDomain] - Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com * @param {string} [params.cookies] - Your cookies will be set in a browser of our worker. Suitable for captcha on Google services. The format is: key1=val1; key2=val2 * @param {string} [params.proxyAddress] - Proxy IP address or hostname * @param {string} [params.proxyLogin] - Login for basic authentication on the proxy * @param {string} [params.proxyPassword] - Password for basic authentication on the proxy * @param {string} [params.proxyType] - Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5 * @param {string} [params.proxyPort] - Proxy port * */ constructor({ enterprisePayload, ...params }: RecaptchaV2EnterpriseTaskParams); } type RecaptchaV2EnterpriseTaskProxylessParams = _RecaptchaV2EnterpriseTaskParams & ProxylessTaskParams<RecaptchaV2TaskBaseParams>; /** * Token-based method for automated solving of reCAPTCHA V2. * @extends {RecaptchaV2TaskBase} * @see {@link https://2captcha.com/api-docs/recaptcha-v2-enterprise} */ declare class RecaptchaV2EnterpriseTaskProxyless extends RecaptchaV2TaskBase implements _RecaptchaV2EnterpriseTaskParams, _IsTaskType { /** * @type {boolean} _isRecaptchaV2EnterpriseTaskProxyless - Only used for correct method overloading intellisense */ readonly _isRecaptchaV2EnterpriseTaskProxyless: _IsTaskType["_isRecaptchaV2EnterpriseTaskProxyless"]; enterprisePayload?: Record<string, string>; /** * Create RecaptchaV2EnterpriseTaskProxyless * @see {@link https://2captcha.com/api-docs/recaptcha-v2-enterprise} * @param {Object} params - RecaptchaV2EnterpriseTaskProxylessParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - reCAPTCHA sitekey. Can be found inside data-sitekey property of the reCAPTCHA div element or inside k parameter of the requests to reCAPTHCHA API. You can also use the script to find the value * @param {string} [params.userAgent] - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents * @param {boolean}[params.isInvisible] - Pass true for Invisible version of reCAPTCHA - a case when you don't see the checkbox, but the challenge appears. Mostly used with a callback function * @param {string} [params.recaptchaDataSValue] - The value of data-s parameter. Can be required to bypass the captcha on Google services * @param {string} [params.enterprisePayload] - Additional parameters passed to grecaptcha.enterprise.render call. For example, there can be an object containing s value * @param {string} [params.apiDomain] - Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com * @param {string} [params.cookies] - Your cookies will be set in a browser of our worker. Suitable for captcha on Google services. The format is: key1=val1; key2=val2 */ constructor({ enterprisePayload, ...params }: RecaptchaV2EnterpriseTaskProxylessParams); } type RecaptchaV2TaskProxylessParams = ProxylessTaskParams<RecaptchaV2TaskBaseParams>; /** * Token-based method for automated solving of reCAPTCHA V2. * @extends {RecaptchaV2TaskProxylessBase} * @see {@link https://2captcha.com/api-docs/recaptcha-v2} */ declare class RecaptchaV2TaskProxyless extends RecaptchaV2TaskBase implements _IsTaskType { /** * @type {boolean} _isRecaptchaV2TaskProxyless - Only used for correct method overloading intellisense */ readonly _isRecaptchaV2TaskProxyless: _IsTaskType["_isRecaptchaV2TaskProxyless"]; /** * Create RecaptchaV2TaskProxyless * @see {@link https://2captcha.com/api-docs/recaptcha-v2} * @param {Object} params - RecaptchaV2TaskProxylessParams * @param {string} [params.websiteURL] - The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users * @param {string} [params.websiteKey] - reCAPTCHA sitekey. Can be found inside data-sitekey property of the reCAPTCHA div element or inside k parameter of the requests to reCAPTHCHA API. You can also use the script to find the value * @param {string} [params.userAgent] - User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents * @param {boolean}[params.isInvisible] - Pass true for Invisible version of reCAPTCHA - a case when you don't see the checkbox, but the challenge appears. Mostly used with a callback function * @param {string} [params.recaptchaDataSValue] - The value of data-s parameter. Can be required to bypass the captcha on Google services * @param {string} [params.apiDomain] - Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com * @param {string} [params.cookies] - Your cookies will be set in a browser of our worker. Suitable for captcha on Google services. The format is: key1=val1; key2=val2 */ constructor(params: RecaptchaV2TaskProxylessParam