UNPKG

@captcha-libs/capsolver

Version:

CapSolver NodeJS client, captcha recognition service

1,239 lines (1,193 loc) 127 kB
import { CaptchaClient } from '@captcha-libs/captcha-client'; interface CaptchaClientParams { "clientKey": string; "pollingInterval"?: number; "timeout"?: number; } type CapSolverCreateTaskResponse<TSolution = unknown> = { "errorCode": string; "errorDescription": string; "errorId": number; "solution"?: TSolution; "taskId": string; }; interface CapSolverBalanceSuccessResponse { "balance": number; "errorId": number; "packages": Package[]; } interface Package { "packageId": string; "type": number; "title": string; "numberOfCalls": number; "status": number; "token": string; "expireTime": number; } interface FeedbackTaskParams { "code"?: number; "invalid": boolean; "message"?: string; "taskId": string; } interface FeedbackResponseError { "errorCode": string; "errorDescription": string; "errorId": number; } interface FeedbackResponseSuccess { "errorId": number; "message": string; } type FeedbackResponse = FeedbackResponseError | FeedbackResponseSuccess; interface VisionEngineAngleSolution { "angle": number; } interface VisionEngineDistanceSolution { "distance": number; } interface VisionEngineSpaceDetectionSolution { "box": number[]; } /** * @see {@link https://docs.capsolver.com/guide/recognition/VisionEngine.html#example-response} */ type VisionEngineSolution = VisionEngineAngleSolution & VisionEngineDistanceSolution & VisionEngineSpaceDetectionSolution; /** * @see {@link https://docs.capsolver.com/guide/recognition/AwsWafClassification.html#example-response} */ interface AwsWafClassificationSolution { "box": number[]; "distance": number; "objects": number[]; } /** * @see {@link https://docs.capsolver.com/guide/recognition/FunCaptchaClassification.html#example-response} */ interface FunCaptchaClassificationSolution { "objects": Array<number>; } /** * @see {@link https://docs.capsolver.com/guide/recognition/HCaptchaClassification.html#example-response} */ interface HCaptchaClassificationSolution { "box": Array<number>; "imageSize": Array<number>; "objects": Array<boolean>; "tags": Array<string>; } /** * @see {@link https://docs.capsolver.com/guide/recognition/ImageToTextTask.html#example-response} */ interface ImageToTextSolution { "text": string; } /** * @see {@link https://docs.capsolver.com/guide/recognition/ReCaptchaClassification.html#response-example} */ interface MultiSolution { "objects": number[]; "size": number; "type": string; } /** * @see {@link https://docs.capsolver.com/guide/recognition/ReCaptchaClassification.html#response-example} */ interface SingleSolution { "hasObject": boolean; "size": number; "type": string; } type ReCaptchaV2ClassificationSolution = MultiSolution | SingleSolution; /** * @see {@link https://docs.capsolver.com/guide/captcha/ReCaptchaV2.html#example-response-1} */ interface ReCaptchaV2TaskSolution { "expireTime": number; "gRecaptchaResponse": string; "userAgent": string; } /** * @see {@link https://docs.capsolver.com/guide/captcha/MtCaptcha.html#example-response-1} */ interface MtCaptchaTaskSolution { "token": string; } /** * @see {@link https://docs.capsolver.com/guide/captcha/HCaptcha.html#example-response-1} */ interface HCaptchaTaskSolution { "captchaKey": string; "expireTime": number; "gRecaptchaResponse": string; "timestamp": number; "userAgent": string; } /** * @see {@link https://docs.capsolver.com/guide/captcha/Geetest.html#example-response-1} */ interface GeeTestV3TaskSolution { "challenge": string; "validate": string; } /** * @see {@link https://docs.capsolver.com/guide/captcha/FunCaptcha.html#example-response-1} */ interface FunCaptchaTaskSolution { "token": string; "userAgent": string; } /** * @see {@link https://docs.capsolver.com/guide/antibots/datadome.html#example-response-1} */ interface DataDomeSliderTaskSolution { "cookie": string; "userAgent": string; } /** * @see {@link https://docs.capsolver.com/guide/antibots/imperva.html#example-response-1} */ interface AntiImpervaTaskSolution { "token": string; } /** * @deprecated removed from service support */ interface AntiCyberSiAraTaskSolution { "token": string; } /** * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/#example-response-1} */ interface AntiCloudflareTaskSolution { "token": string; "type": string; "userAgent": string; } /** * @deprecated removed from service support */ interface AntiAwsWafTaskSolution { "cookie": string; } /** * @deprecated removed from service support */ interface AntiAkamaiPowTaskSolution { "pow": string; } /** * @deprecated removed from service support */ interface AntiAkamaiSensorTaskSolution { "deviceId": string; "deviceName": string; "sensors": string[]; "version": string; } /** * @deprecated removed from service support */ interface AntiAkamaiWebTaskSolution { "sensorData": string; } /** * @see {@link https://docs.capsolver.com/guide/captcha/Geetest.html#example-response-1} */ interface GeeTestV4TaskSolution { "captcha_id": string; "captcha_output": string; "gen_time": string; "lot_number": string; "pass_token": string; "risk_type": string; } /** * @see {@link https://docs.capsolver.com/guide/captcha/ReCaptchaV3.html#example-response-1} */ interface ReCaptchaV3TaskSolution { "expireTime": number; "gRecaptchaResponse": string; "userAgent": string; } declare const _TaskTypes: readonly ["HCaptchaClassification", "ImageToTextTask", "ReCaptchaV2EnterpriseTask", "ReCaptchaV2EnterpriseTaskProxyLess", "ReCaptchaV2Task", "ReCaptchaV2TaskProxyLess", "ReCaptchaV3EnterpriseTask", "ReCaptchaV3EnterpriseTaskProxyLess", "ReCaptchaV3M1TaskProxyLess", "ReCaptchaV3Task", "ReCaptchaV3TaskProxyLess", "FunCaptchaClassification", "ImageToTextTask", "HCaptchaClassification", "ReCaptchaV2Classification", "AwsWafClassification", "MtCaptchaTask", "MtCaptchaTaskProxyLess", "DataDomeSliderTask", "AntiAwsWafTask", "AntiAwsWafTaskProxyLess", "AntiCyberSiAraTask", "AntiCyberSiAraTaskProxyLess", "AntiImpervaTask", "AntiImpervaTaskProxyLess", "AntiCloudflareTask", "AntiAkamaiBMPTask", "AntiAkamaiWebTask", "HCaptchaTask", "HCaptchaTaskProxyLess", "FunCaptchaTaskProxyLess", "FunCaptchaTask", "GeeTestTask", "GeeTestTaskProxyLess", "VisionEngine", "AntiTurnstileTaskProxyLess"]; type TaskTypes = typeof _TaskTypes[number]; interface BaseParams { "_endpoint"?: string; "type": TaskTypes; } type ProxyTypes = "http" | "https" | "socks5"; interface ProxyCredentials { "proxyAddress": string; "proxyLogin"?: string; "proxyPassword"?: string; "proxyPort": number; "proxyType": ProxyTypes; } type ProxylessTaskParams<T> = Omit<T, keyof ProxyCredentials | "proxy">; type ProxyRequiredTaskParams<T> = ProxyCredentials & T & { "proxy"?: never; } | T & { [PC in keyof ProxyCredentials]?: never; } & { "proxy": string; }; /** * @type {_IsTaskType} _IsTaskType - Only used for correct method overloading intellisense */ type _IsTaskType = { readonly [type in TaskTypes as `_is${type}`]?: boolean; }; /** * @classdesc BaseTask for Capsolver tasks * @class */ declare abstract class BaseTask { /** * @type {TaskTypes} type - task type */ protected type: TaskTypes; /** * @type {string} _endpoint - special endpoint for task request */ readonly _endpoint: string; constructor(params: BaseParams); } interface AwsWafClassificationParams { "images": Array<string>; "question": string; "websiteKey"?: string; "websiteURL"?: string; } /** * @classdesc AWS WAF Images Recognize * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/recognition/AwsWafClassification.html} */ declare class AwsWafClassification extends BaseTask implements AwsWafClassificationParams, _IsTaskType { /** * @type {boolean} _isAwsWafClassification - Only used for correct method overloading intellisense */ readonly _isAwsWafClassification: _IsTaskType["_isAwsWafClassification"]; /** * Create AwsWafClassification * @see {@link https://docs.capsolver.com/guide/recognition/AwsWafClassification.html} * @param {object} params - AwsWafClassificationParams * @param {string} [params.question] - For full names of questions, please refer to the following list of questions. * @param {string[]} [params.images] - base64 image string * @param {string=} [params.websiteKey] - Website key to improve accuracy * @param {string=} [params.websiteURL] - Page source url to improve accuracy */ constructor({ websiteKey, question, websiteURL, images }: AwsWafClassificationParams); /** * @type {string} question - For full names of questions, please refer to the following list of questions. */ question: string; /** * @type {string[]} images - base64 image string */ images: Array<string>; /** * @type {string=} websiteKey - Website key to improve accuracy */ websiteKey?: string; /** * * @type {string=} websiteURL - Page source url to improve accuracy */ websiteURL?: string; } interface FunCaptchaClassificationParams { "images": string; "module"?: string; "question": string; "websiteKey"?: string; "websiteURL"?: string; } /** * @classdesc FunCaptcha Images Recognize * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/recognition/FunCaptchaClassification.html} * @deprecated deleted from service support */ declare class FunCaptchaClassification extends BaseTask implements FunCaptchaClassificationParams, _IsTaskType { /** * @type {boolean} _isFunCaptchaClassification - Only used for correct method overloading intellisense */ readonly _isFunCaptchaClassification: _IsTaskType["_isFunCaptchaClassification"]; /** * Create FunCaptchaClassification * @see {@link https://docs.capsolver.com/guide/recognition/FunCaptchaClassification.html} * @param {Object} params - ImageToTextParams * @param {string} [params.question] - Question name. this param value from API response game_variant field. Exmaple: maze,maze2,flockCompass,3d_rollball_animals * @param {string} [params.images] - Base64 encoded image, can be a screenshot (pass only the hexagonal image, do not pass the rest of the content) * @param {string} [params.module] - module name {@see https://docs.capsolver.com/guide/recognition/FunCaptchaClassification.html} * @param {string} [params.websiteURL] - Page source url to improve accuracy * @param {string} [params.websiteKey] - Website key to improve accuracy */ constructor({ images, module, question, websiteKey, websiteURL }: FunCaptchaClassificationParams); /** * @type {string} question - Question name. this param value from API response game_variant field. Exmaple: maze,maze2,flockCompass,3d_rollball_animals */ question: string; /** * @type {string} images - Base64 encoded image, can be a screenshot (pass only the hexagonal image, do not pass the rest of the content) */ images: string; /** * @type {string} module - module name * @see {@link https://docs.capsolver.com/guide/recognition/FunCaptchaClassification.html} */ module?: string; /** * @type {string} websiteURL - Page source url to improve accuracy */ websiteURL?: string; /** * @type {string} websiteKey - Website key to improve accuracy */ websiteKey?: string; } interface HCaptchaClassificationParams { "queries": Array<string>; "question": string; "websiteKey"?: string; "websiteURL"?: string; } /** * @classdesc HCaptcha Images Recognize * @class * @deprecated deleted from service support * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/recognition/HCaptchaClassification.html} */ declare class HCaptchaClassification extends BaseTask implements HCaptchaClassificationParams, _IsTaskType { /** * @type {boolean} _isHCaptchaClassification - Only used for correct method overloading intellisense */ readonly _isHCaptchaClassification: _IsTaskType["_isHCaptchaClassification"]; /** * Create HCaptchaClassification * @see {@link https://docs.capsolver.com/guide/recognition/HCaptchaClassification.html} * @param {Object} params - ImageToTextParams * @param {string} [params.question] - English is supported only. Please convert other languages by yourself * @param {string} [params.queries] - Base64 encoded image, do not include "data:image/***; base64," Assembles the picture as a list: [base64,base64,base64...] * @param {string} [params.websiteKey] - Website key to improve accuracy * @param {string} [params.websiteURL] - Page source url to improve accuracy */ constructor({ queries, question, websiteKey, websiteURL }: HCaptchaClassificationParams); /** * @type {string} question - English is supported only. Please convert other languages by yourself */ question: string; queries: string[]; /** * @type {string} websiteKey - Website key to improve accuracy */ websiteKey?: string; /** * @type {string} websiteURL - Page source url to improve accuracy */ websiteURL?: string; } declare const _ImageToTextModules: readonly ["common", "module_001", "module_002", "module_003", "module_004", "module_005", "module_006", "module_007", "module_008", "module_010", "module_012", "module_013", "module_014", "module_015", "module_016", "module_017", "module_018", "module_019", "module_020", "module_021", "module_022", "module_023", "module_024", "module_025", "module_026", "module_027", "module_028", "module_029"]; type ImageToTextModules = typeof _ImageToTextModules[number]; interface ImageToTextParams { "body": string; "module"?: ImageToTextModules; "score"?: number; "websiteURL"?: string; } /** * @classdesc OCR ImageToText * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/recognition/ImageToTextTask.html} */ declare class ImageToTextTask extends BaseTask implements ImageToTextParams, _IsTaskType { /** * @type {boolean} _isImageToTextTask - Only used for correct method overloading intellisense */ readonly _isImageToTextTask: _IsTaskType["_isImageToTextTask"]; /** * Create ImageToTextTask * @see {@link https://docs.capsolver.com/guide/recognition/ImageToTextTask.html} * @param {Object} params - ImageToTextParams * @param {string} [params.body] - base64 encoded content of the image (no newlines) (no data:image/*; base64, content * @param {boolean=} [params.isCaseSensitive] - Case sensitive or not * @param {ImageToTextModules=} [params.module] - Specifies the module. Currently, the supported modules are common and queueit * @param {number=} [params.score] - 0.8 ~ 1, Identify the matching degree. If the recognition rate is not within the range, no deduction * @param {string} [params.websiteURL] - Page source url to improve accuracy */ constructor({ body, "module": _module, score, websiteURL }: ImageToTextParams); /** * @type {string} body - base64 encoded content of the image (no newlines) (no data:image/*; base64, content */ body: string; /** * @type {boolean=} case - Case sensitive or not */ case?: boolean; /** * @type {ImageToTextModules=} module - Specifies the module. Currently, the supported modules are common and queueit * {@see https://docs.capsolver.com/guide/recognition/ImageToTextTask.html} */ module?: ImageToTextModules; /** * @type {number=} score - 0.8 ~ 1, Identify the matching degree. If the recognition rate is not within the range, no deduction */ score?: number; /** * @type {string} websiteURL - Page source url to improve accuracy */ websiteURL?: string; } interface ReCaptchaClassificationParams { "image": string; "question": string; "websiteKey"?: string; "websiteURL"?: string; } /** * @classdesc ReCaptcha Images Recognize * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/recognition/ReCaptchaClassification.html} */ declare class ReCaptchaV2Classification extends BaseTask implements ReCaptchaClassificationParams, _IsTaskType { /** * @type {boolean} _isReCaptchaV2Classification - Only used for correct method overloading intellisense */ readonly _isReCaptchaV2Classification: _IsTaskType["_isReCaptchaV2Classification"]; /** * Create ReCaptchaV2Classification * @see {@link https://docs.capsolver.com/guide/recognition/ReCaptchaClassification.html} * @param {Object} params - ReCaptchaClassificationParams * @param {string} [params.question] - please refer to the following list of questions. * @param {string} [params.image] - base64 image string * @param {string=} [params.websiteKey] - Website key to improve accuracy * @param {string=} [params.websiteURL] - Page source url to improve accuracy */ constructor({ websiteKey, question, websiteURL, image }: ReCaptchaClassificationParams); /** * @type {string} question - please refer to the following list of questions. * @see {@link https://docs.capsolver.com/guide/recognition/ReCaptchaClassification.html} */ question: string; /** * @type {string} image - base64 image string */ image: string; /** * @type {string=} websiteKey - Website key to improve accuracy */ websiteKey?: string; /** * @type {string=} websiteURL - Page source url to improve accuracy */ websiteURL?: string; } declare const _VisionEngineModules: readonly ["slider_1", "rotate_1", "space_detection", "slider_temu_plus", "select_temu"]; type VisionEngineModules = typeof _VisionEngineModules[number]; interface VisionEngineParams { "image": string; "imageBackground"?: string; "module": VisionEngineModules; "question"?: string; "websiteURL"?: string; } /** * @classdesc OCR VisionEngine * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/recognition/VisionEngine.html} */ declare class VisionEngine extends BaseTask implements VisionEngineParams, _IsTaskType { /** * @type {boolean} _isVisionEngine - Only used for correct method overloading intellisense */ readonly _isVisionEngine: _IsTaskType["_isVisionEngine"]; /** * Create VisionEngine * @see {@link https://docs.capsolver.com/guide/recognition/VisionEngine.html} * @param {Object} params - VisionEngineParams * @param {string} [params.image] - base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) * @param {string} [params.imageBackground] - base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) * @param {string} [params.question] - required for "space_detection" module * @param {VisionEngineModules=} [params.module] - Specifies the module. * @param {string} [params.websiteURL] - Page source url to improve accuracy */ constructor({ image, imageBackground, question, module, websiteURL }: VisionEngineParams); /** * @type {string} image - base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) */ image: string; /** * @type {string} image - base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) */ imageBackground?: string; /** * @type {VisionEngineModules=} module - Specifies the module * {@see https://docs.capsolver.com/guide/recognition/VisionEngine.html} */ module: VisionEngineModules; /** * @param {string} question - required for "space_detection" module */ question?: string; /** * @type {string} websiteURL - Page source url to improve accuracy */ websiteURL?: string; } interface AntiAkamaiBMPTaskParams { "count"?: number; "country"?: string; "deviceId"?: string; "deviceName"?: string; "metadata"?: Record<string, string>; "packageName"?: string; "pow"?: string; "version"?: string; } /** * @classdesc Class for AntiAkamaiBMPTask. This task type uses a separate endpoint for fetching /akamaibmp/invoke * @class * @deprecated deleted from service support * @extends {AntiAkamaiBMPTaskBase} * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} */ declare class AntiAkamaiBMPTask extends BaseTask implements AntiAkamaiBMPTaskParams, _IsTaskType { /** * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense */ readonly _isAntiAkamaiBMPTask: _IsTaskType["_isAntiAkamaiBMPTask"]; /** * Create AntiAkamaiBMPTaskBase * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} * @param {object} params - AntiAkamaiBMPTaskBaseParams * @param {number} [params.count] - Sensor combinations acquired at once, 0< count <= 50, max 50 items acquired at once * @param {string} [params.deviceId] - If you want to have a fixed device ID in the sensor, you can pass this parameter * @param {string} [params.deviceName] - Input fixed deviceInfo,default is: random. example: iPhone14,2/16.0.2 * @param {string} [params.packageName] - Package name of AkamaiBMP mobile APP, de.package.iphone * @param {string} [params.pow] - Support: /_bm/get_params data. If this parameter is passed in, the other parameters will be ignored to generate the pow string * @param {string} [params.version] - AKAMAI BMP Version number, default is: 3.2.6 , max support 3.3.1 */ constructor({ count, deviceId, deviceName, packageName, pow, version, metadata, country }: AntiAkamaiBMPTaskParams); /** * @type {number} count - Sensor combinations acquired at once, 0< count <= 50, max 50 items acquired at once */ count?: number; /** * @type {string} deviceId - If you want to have a fixed device ID in the sensor, you can pass this parameter */ deviceId?: string; /** * @type {string} deviceName - Input fixed deviceInfo,default is: random. example: iPhone14,2/16.0.2 */ deviceName?: string; /** * @type {string} packageName - Package name of AkamaiBMP mobile APP, de.package.iphone */ packageName?: string; pow?: string; /** * @type {string} version - AKAMAI BMP Version number, default is: 3.2.6 , max support 3.3.1 */ version?: string; /** * @type {object} metadata - Use for sensor task */ metadata?: Record<string, string>; /** * @type {string} country - */ country?: string; } type AntiAkamaiPowTaskParams = Required<Pick<AntiAkamaiBMPTaskParams, "deviceId" | "pow">>; /** * @classdesc AntiAkamaiPowTask This task type uses a separate endpoint for fetching /akamaibmp/invoke * @class * @deprecated deleted from service support * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} */ declare class AntiAkamaiPowTask extends BaseTask implements AntiAkamaiPowTaskParams, _IsTaskType { /** * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense */ readonly _isAntiAkamaiBMPTask: _IsTaskType["_isAntiAkamaiBMPTask"]; /** * Create AntiAkamaiPowTask * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} * @param {object} params - AntiAkamaiPowTaskParams * @param {string} [params.deviceId] - If you want to have a fixed device ID in the sensor, you can pass this parameter * @param {string} [params.pow] - Support: /_bm/get_params data. If this parameter is passed in, the other parameters will be ignored to generate the pow string */ constructor({ deviceId, pow }: AntiAkamaiPowTaskParams); /** * @type {string} deviceName - Input fixed deviceInfo,default is: random. example: iPhone14,2/16.0.2 */ deviceId: string; pow: string; } type AntiAkamaiSensorTaskParams = Omit<AntiAkamaiBMPTaskParams, "pow"> & Required<Pick<AntiAkamaiBMPTaskParams, "packageName" | "version">>; /** * @classdesc AntiAkamaiSensorTask This task type uses a separate endpoint for fetching /akamaibmp/invoke * @class * @deprecated deleted from service support * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} */ declare class AntiAkamaiSensorTask extends BaseTask implements AntiAkamaiSensorTaskParams, _IsTaskType { /** * @type {boolean} _isAntiAkamaiBMPTask - Only used for correct method overloading intellisense */ readonly _isAntiAkamaiBMPTask: _IsTaskType["_isAntiAkamaiBMPTask"]; /** * Create AntiAkamaiSensorTask * This task type uses a separate endpoint for fetching /akamaibmp/invoke * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} * @param {object} params - AntiAkamaiSensorTaskParams * @param {string} [params.packageName] - required. Package name of AkamaiBMP mobile APP, de.package.iphone * @param {string} [params.version] - required. AKAMAI BMP Version number, default is: 3.2.6 , max support 3.3.1 * @param {number} [params.count] - Sensor combinations acquired at once, 0< count <= 50, max 50 items acquired at once * @param {string} [params.deviceId] - If you want to have a fixed device ID in the sensor, you can pass this parameter * @param {string} [params.deviceName] - Input fixed deviceInfo,default is: random. example: iPhone14,2/16.0.2 */ constructor({ count, country, deviceId, deviceName, metadata, packageName, version }: AntiAkamaiSensorTaskParams); /** * @type {number} count - Sensor combinations acquired at once, 0< count <= 50, max 50 items acquired at once */ count?: number; /** * @type {string} country - */ country?: string; /** * @type {string} deviceId - If you want to have a fixed device ID in the sensor, you can pass this parameter */ deviceId?: string; /** * @type {string} deviceName - Input fixed deviceInfo,default is: random. example: iPhone14,2/16.0.2 */ deviceName?: string; /** * @type {object} metadata - Use for sensor task */ metadata?: Record<string, string>; /** * @type {string} packageName - Package name of AkamaiBMP mobile APP, de.package.iphone */ packageName: string; /** * @type {string} version - AKAMAI BMP Version number, default is: 3.2.6 , max support 3.3.1 */ version: string; } type AntiAkamaiWebTaskParams = { "abck"?: string; "bmsz"?: string; "url": string; "userAgent"?: string; }; /** * @classdesc AntiAkamaiWebTask This task type uses a separate endpoint for fetching /akamaibmp/invoke * @class * @extends {AntiAkamaiWebTaskBase} * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} * @deprecated deleted from service support */ declare class AntiAkamaiWebTask extends BaseTask implements AntiAkamaiWebTaskParams, _IsTaskType { /** * @type {boolean} _isAntiAkamaiWebTask - Only used for correct method overloading intellisense */ readonly _isAntiAkamaiWebTask: _IsTaskType["_isAntiAkamaiWebTask"]; /** * Create AntiAkamaiWebTaskBase * @see {@link https://docs.capsolver.com/guide/antibots/akamaibmp.html} * @param {object} params - AntiAkamaiWebTaskBaseParams * @param {string} [params.url] - browser url address * @param {string} [params.abck] - akamai cookie * @param {string} [params.userAgent] - The browser's request header ua */ constructor({ abck, bmsz, url, userAgent }: AntiAkamaiWebTaskParams); /** * @type {string} url - browser url address */ url: string; /** * @type {string} abck - akamai cookie */ abck?: string; /** * @type {string} bmsz - akamai cookie */ bmsz?: string; /** * @type {string} userAgent - The browser's request header ua */ userAgent?: string; } type AntiAwsWafTaskBaseParams = Partial<ProxyCredentials> & { "awsChallengeJS"?: string; "awsContext"?: string; "awsIv"?: string; "awsKey"?: string; "proxy"?: string; "websiteURL": string; }; /** * @classdesc Base class for AntiAwsWafTask * @class * @see {@link https://docs.capsolver.com/guide/captcha/awsWaf.html} * @extends {BaseTask} */ declare abstract class AntiAwsWafTaskBase extends BaseTask implements AntiAwsWafTaskBaseParams { constructor({ awsChallengeJS, awsContext, awsIv, awsKey, proxy, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiAwsWafTaskBaseParams, type: TaskTypes); proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyCredentials["proxyType"]; /** * @type {string=} awsChallengeJS - When the status code returned by the websiteURL page is 202, you only need to pass in awsChallengeJs; */ awsChallengeJS?: string; /** * @type {string=} awsContext - When the status code returned by the websiteURL page is 405, you need to pass in awsContext */ awsContext?: string; /** * @type {string=} awsIv - When the status code returned by the websiteURL page is 405, you need to pass in awsIv */ awsIv?: string; /** * @type {string=} awsKey - When the status code returned by the websiteURL page is 405, you need to pass in awsKey */ awsKey?: string; /** * @type {string=} proxy - proxy */ proxy?: string; /** * @type {string} websiteURL - The URL of the page that returns the captcha info */ websiteURL: string; } type AntiAwsWafTaskParams = ProxyRequiredTaskParams<AntiAwsWafTaskBaseParams>; /** * @classdesc AntiAwsWafTask this task type require your own proxies. * @class * @extends {AntiAwsWafTaskBase} * @see {@link https://docs.capsolver.com/guide/captcha/awsWaf.html} */ declare class AntiAwsWafTask extends AntiAwsWafTaskBase implements _IsTaskType { /** * @type {boolean} _isAntiAwsWafTask - Only used for correct method overloading intellisense */ readonly _isAntiAwsWafTask: _IsTaskType["_isAntiAwsWafTask"]; /** * Create AntiAwsWafTask - this task type require your own proxies. * @see {@link https://docs.capsolver.com/guide/captcha/awsWaf.html} * @param {Object} params - AntiAwsWafTaskParams * @param {string=} [params.awsChallengeJS] - When the status code returned by the websiteURL page is 202, you only need to pass in awsChallengeJs; * @param {string=} [params.awsContext] - When the status code returned by the websiteURL page is 405, you need to pass in awsContext * @param {string=} [params.awsIv] - When the status code returned by the websiteURL page is 405, you need to pass in awsIv * @param {string=} [params.awsKey] - When the status code returned by the websiteURL page is 405, you need to pass in awsKey * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {string} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType * @param {string} [params.websiteURL] - The URL of the page that returns the captcha info */ constructor(params: AntiAwsWafTaskParams); } type AntiAwsWafTaskProxyLessParams = ProxylessTaskParams<AntiAwsWafTaskBaseParams>; /** * @classdesc AntiAwsWafTaskProxyLess this task type don't require your own proxies. * @class * @extends {AntiAwsWafTaskBase} * @see {@link https://docs.capsolver.com/guide/captcha/awsWaf.html} */ declare class AntiAwsWafTaskProxyLess extends AntiAwsWafTaskBase implements _IsTaskType { /** * @type {boolean} _isAntiAwsWafTaskProxyLess - Only used for correct method overloading intellisense */ readonly _isAntiAwsWafTaskProxyLess: _IsTaskType["_isAntiAwsWafTaskProxyLess"]; /** * Create AntiAwsWafTask * @see {@link https://docs.capsolver.com/guide/captcha/awsWaf.html} * @param {Object} params - AntiAwsWafTaskProxyLessParams * @param {string=} [params.awsChallengeJS] - When the status code returned by the websiteURL page is 202, you only need to pass in awsChallengeJs; * @param {string=} [params.awsContext] - When the status code returned by the websiteURL page is 405, you need to pass in awsContext * @param {string=} [params.awsIv] - When the status code returned by the websiteURL page is 405, you need to pass in awsIv * @param {string=} [params.awsKey] - When the status code returned by the websiteURL page is 405, you need to pass in awsKey * @param {string} [params.websiteURL] - The URL of the page that returns the captcha info */ constructor(params: AntiAwsWafTaskProxyLessParams); } type AntiCloudflareTaskBaseParams = Partial<ProxyCredentials> & { "proxy"?: string; "websiteURL": string; }; /** * @classdesc Base class for AntiCloudflareTask * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html} */ declare abstract class AntiCloudflareTaskBase extends BaseTask implements AntiCloudflareTaskBaseParams { /** * Create AntiCloudflareTask * @see {@link https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html} * @param {object} params - AntiCloudflareTaskParams * @param {string} [params.websiteURL] - The address of the target page. * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {number} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType */ constructor({ websiteURL, proxy, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiCloudflareTaskBaseParams, type: TaskTypes); /** * @type {string} proxy - proxy */ proxy?: string; /** * @type {string} websiteURL - The address of the target page. */ websiteURL: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyCredentials["proxyType"]; } type AntiCloudflareChallengeTaskParams = AntiCloudflareTaskBaseParams; /** * @classdesc AntiCloudflareChallengeTask * @class * @extends {AntiCloudflareTaskBase} * @see {@link https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html} */ declare class AntiCloudflareChallengeTask extends AntiCloudflareTaskBase implements _IsTaskType { /** * @type {boolean} _isAntiCloudflareTask - Only used for correct method overloading intellisense */ readonly _isAntiCloudflareTask: _IsTaskType["_isAntiCloudflareTask"]; /** * Create AntiCloudflareChallengeTask * @see {@link https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html} * @param {object} params - AntiCloudflareChallengeTaskParams * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {number} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType * @param {string} [params.websiteURL] - The address of the target page. */ constructor(params: AntiCloudflareChallengeTaskParams); } type AntiCloudflareTurnstileTaskTypes = "challenge" | "turnstile"; interface AntiCloudflareTurnstileTaskMetadata { "action"?: string; "cdata"?: string; "type": AntiCloudflareTurnstileTaskTypes; } type AntiCloudflareTurnstileTaskParams = AntiCloudflareTaskBaseParams & { "metadata": AntiCloudflareTurnstileTaskMetadata; "websiteKey": string; }; /** * @classdesc AntiCloudflareTurnstileTask * @class * @extends {AntiCloudflareTaskBase} * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/} * @deprecated deleted from service support, * @see AntiTurnstileTaskProxyLess */ declare class AntiCloudflareTurnstileTask extends AntiCloudflareTaskBase implements AntiCloudflareTurnstileTaskParams, _IsTaskType { /** * @type {boolean} _isAntiCloudflareTask - Only used for correct method overloading intellisense */ readonly _isAntiCloudflareTask: _IsTaskType["_isAntiCloudflareTask"]; /** * Create AntiCloudflareTurnstileTask * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/} * @param {Object} params - AntiCloudflareTurnstileTaskParams * @param {string} [params.websiteURL] - The address of the target page. * @param {string=} [params.websiteKey] - Turnstile website key. * @param {object} [params.metadata] - Turnstile extra data {@link https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/} * @param {string} [params.metadata.type] - challenge or turnstile fixed value, default: "turnstile" * @param {string} [params.metadata.cdata] - The value of the data-cdata attribute of the Turnstile element if it exists. * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {string} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType */ constructor({ websiteURL, proxy, metadata, websiteKey, proxyAddress, proxyLogin, proxyPassword, proxyPort, proxyType }: AntiCloudflareTurnstileTaskParams); websiteKey: string; /** * @type {object} [type.metadata] - Turnstile extra data {@link https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/} * @type {string} [type.metadata.type] - challenge or turnstile fixed value. * @type {string} [type.proxy] - proxy * @type {string} [type.websiteURL] - The URL of the page that returns the captcha info */ metadata: AntiCloudflareTurnstileTaskMetadata; } interface AntiTurnstileMetaData { "action"?: string; "cdata"?: string; } type AntiTurnstileTaskProxyLessBaseParams = { "metadata"?: AntiTurnstileMetaData; "websiteKey": string; "websiteURL": string; }; /** * @classdesc Base class for AntiTurnstileTaskProxyLess * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/} */ declare abstract class AntiTurnstileTaskProxyLessBase extends BaseTask implements AntiTurnstileTaskProxyLessBaseParams { /** * Create AntiTurnstileTaskProxyLess * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/} * @param {object} params - AntiTurnstileTaskProxyLessBaseParams * @param {string} [params.websiteURL] - The address of the target page. * @param {string} [params.websiteKey] - Turnstile website key. * @param {Object} [params.metadata] - Turnstile extra data. @see https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/ * @param {string=} [params.metdata.action] - The value of the data-action attribute of the Turnstile element if it exists. * @param {string=} [params.metadata.cdata] - The value of the data-cdata attribute of the Turnstile element if it exists. */ constructor({ websiteURL, websiteKey, metadata }: AntiTurnstileTaskProxyLessBaseParams, type: TaskTypes); /** * @type {string} websiteKey - Turnstile website key. */ websiteKey: string; /** * @type {Object} metadata - Turnstile extra data. @see https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/ * @type {string=?} [metdata.action] - The value of the data-action attribute of the Turnstile element if it exists. * @type {string=?} [metadata.cdata] - The value of the data-cdata attribute of the Turnstile element if it exists. */ metadata?: { "action"?: string | undefined; "cdata"?: string | undefined; } | undefined; /** * @type {string} websiteURL - The address of the target page. */ websiteURL: string; } /** * @classdesc AntiTurnstileTaskProxyLess * @class * @extends {AntiTurnstileTaskProxyLessBase} * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/} */ declare class AntiTurnstileTaskProxyLess extends AntiTurnstileTaskProxyLessBase implements _IsTaskType { /** * @type {boolean} _isAntiTurnstileTaskProxyLess - Only used for correct method overloading intellisense */ readonly _isAntiTurnstileTaskProxyLess: _IsTaskType["_isAntiTurnstileTaskProxyLess"]; /** * Create AntiTurnstileTaskProxyLess * @see {@link https://docs.capsolver.com/en/guide/captcha/cloudflare_turnstile/} * @param {object} params - AntiCloudflareTaskParams * @param {string} [params.websiteURL] - The address of the target page. * @param {string} [params.websiteKey] - Turnstile website key. * @param {Object} [params.metadata] - Turnstile extra data. @see https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/ * @param {string=} [params.metdata.action] - The value of the data-action attribute of the Turnstile element if it exists. * @param {string=} [params.metadata.cdata] - The value of the data-cdata attribute of the Turnstile element if it exists. */ constructor({ websiteURL, websiteKey, metadata }: AntiTurnstileTaskProxyLessBaseParams); } type AntiCyberSiAraTaskBaseParams = Partial<ProxyCredentials> & { "SlideMasterUrlId": string; "proxy"?: string; "userAgent": string; "websiteURL": string; }; /** * @classdesc Base class for AntiCyberSiAraTaskBase * @class * @see {@link https://docs.capsolver.com/guide/captcha/CyberSiara.html} * @extends {BaseTask} */ declare abstract class AntiCyberSiAraTaskBase extends BaseTask implements AntiCyberSiAraTaskBaseParams { /** * Create AntiCyberSiAraTaskBase * @see {@link https://docs.capsolver.com/guide/captcha/CyberSiara.html} * @param {Object} params - AntiCyberSiAraTaskBaseParams * @param {string} [params.SlideMasterUrlId] - you can get MasterUrlId param form api/CyberSiara/GetCyberSiara endpoint * @param {string} [params.userAgent] - browser userAgent,you need submit your userAgent * @param {string} [params.websiteURL] - the current website home page url * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {string} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType */ constructor({ proxy, SlideMasterUrlId, userAgent, websiteURL, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiCyberSiAraTaskBaseParams, type: TaskTypes); /** * @type {string} SlideMasterUrlId - you can get MasterUrlId param form api/CyberSiara/GetCyberSiara endpoint */ SlideMasterUrlId: string; /** * @type {string} userAgent - browser userAgent,you need submit your userAgent */ userAgent: string; /** * @type {string=} proxy - proxy */ proxy?: string; /** * @type {string} websiteURL - the current website home page url */ websiteURL: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyCredentials["proxyType"]; } type AntiCyberSiAraTaskParams = ProxyRequiredTaskParams<AntiCyberSiAraTaskBaseParams>; /** * @classdesc AntiCyberSiAraTask this task type require your own proxies. * @class * @deprecated deleted from service support * @extends {AntiCyberSiAraTaskBase} * @see {@link https://docs.capsolver.com/guide/captcha/CyberSiara.html} */ declare class AntiCyberSiAraTask extends AntiCyberSiAraTaskBase implements _IsTaskType { /** * @type {boolean} _isAntiCyberSiAraTask - Only used for correct method overloading intellisense */ readonly _isAntiCyberSiAraTask: _IsTaskType["_isAntiCyberSiAraTask"]; /** * Create AntiCyberSiAraTask this task type require your own proxies. * @see {@link https://docs.capsolver.com/guide/captcha/CyberSiara.html} * @param {Object} params - AntiCyberSiAraTaskParams * @param {string} [params.SlideMasterUrlId] - you can get MasterUrlId param form api/CyberSiara/GetCyberSiara endpoint * @param {string} [params.userAgent] - browser userAgent,you need submit your userAgent * @param {string} [params.websiteURL] - the current website home page url * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {string} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType */ constructor(params: AntiCyberSiAraTaskParams); } type AntiCyberSiAraTaskProxyLessParams = ProxylessTaskParams<AntiCyberSiAraTaskBaseParams>; /** * @classdesc AntiCyberSiAraTaskProxyLess this task type don't require your own proxies. * @class * @deprecated deleted from service support * @extends {AntiCyberSiAraTaskBase} * @see {@link https://docs.capsolver.com/guide/captcha/CyberSiara.html} */ declare class AntiCyberSiAraTaskProxyLess extends AntiCyberSiAraTaskBase implements _IsTaskType { /** * @type {boolean} _isAntiCyberSiAraTaskProxyLess - Only used for correct method overloading intellisense */ readonly _isAntiCyberSiAraTaskProxyLess: _IsTaskType["_isAntiCyberSiAraTaskProxyLess"]; /** * Create AntiCyberSiAraTaskProxyLess * @see {@link https://docs.capsolver.com/guide/captcha/CyberSiara.html} * @param {object} params - AntiCyberSiAraTaskProxyLessParams * @param {string} [params.SlideMasterUrlId] - you can get MasterUrlId param form api/CyberSiara/GetCyberSiara endpoint * @param {string} [params.userAgent] - browser userAgent,you need submit your userAgent * @param {string} [params.websiteURL] - the current website home page url */ constructor(params: AntiCyberSiAraTaskProxyLessParams); } type AntiImpervaTaskBaseParams = Partial<ProxyCredentials> & { "proxy"?: string; "reese84"?: boolean; "reeseScriptUrl"?: string; "reeseToken"?: string; "userAgent": string; "utmvc"?: boolean; "websiteUrl": string; }; /** * @classdesc Base class for AntiImperva task * @class * @extends {BaseTask} * @see {@link https://docs.capsolver.com/guide/antibots/imperva.html} */ declare abstract class AntiImpervaTaskBase extends BaseTask implements AntiImpervaTaskBaseParams { /** * Create AntiImpervaTaskBase * @see {@link https://docs.capsolver.com/guide/antibots/imperva.html} * @param {object} params - AntiImpervaTaskBaseParams * @param {string} [params.websiteUrl] - The website url * @param {string} [params.userAgent] - browser userAgent * @param {boolean} [params.utmvc] - if type is AntiImpervaTask,you need submit it. Default: false * @param {boolean} [params.reese84=false] - if cookie contains incap_see_xxx,nlbi_xxx,visid_inap_xxx,mean is true. Default = false * @param {string} [params.reeseScriptUrl] - The URL typically has several dashes (-) and random words * @param {string} [params.reeseToken] - If your reeseToken has expired, you can send current reeseToken to obtain a new * @param {string} [params.proxy] - proxy * @param {string} [params.proxyAddress] - proxyAddress * @param {string} [params.proxyLogin] - proxyLogin * @param {string} [params.proxyPassword] - proxyPassword * @param {number} [params.proxyPort] - proxyPort * @param {string} [params.proxyType] - proxyType */ constructor({ websiteUrl, userAgent, utmvc, reese84, reeseScriptUrl, reeseToken, proxy, proxyAddress, proxyPort, proxyType, proxyLogin, proxyPassword }: AntiImpervaTaskBaseParams, type: TaskTypes); /** * @type {string} websiteUrl - The website url */ websiteUrl: string; /** * @type {string} userAgent - browser userAgent */ userAgent: string; /** * proxy */ proxy?: string; /** * @type {boolean=} utmvc - if type is AntiImpervaTask,you need submit it */ utmvc?: boolean; /** * @type {boolean=} [reese84=false] - if cookie contains incap_see_xxx,nlbi_xxx,visid_inap_xxx,mean is true */ reese84?: boolean; /** * @type {string=} reeseScriptUrl - The URL typically has several dashes (-) and random words */ reeseScriptUrl?: string; /** * @type {string=} reeseToken - If your reeseToken has expired, you can send current reeseToken to obtain a new reeseToken. */ reeseToken?: string; proxyAddress?: string; proxyLogin?: string; proxyPassword?: string; proxyPort?: number; proxyType?: ProxyCredentials["proxyType"]; } type AntiImpervaTaskParams = ProxyRequiredTaskParams<AntiImpervaTaskBaseParams>; /** * @classdesc AntiImpervaTask this task type require your own proxies. * @class * @deprecated deleted from service support * @extends {AntiImpervaTaskBase} * @see {@link https://docs.capsolver.com/guide/antibots/imperva.html} */