Skip to main content

Class: RecaptchaV3Task

Hierarchy

  • CapmonsterClient

    RecaptchaV3Task

Constructors

constructor

new RecaptchaV3Task(clientKey): RecaptchaV3Task

Initialize a new RecaptchaV3Task for handling the captchas

Parameters

NameTypeDescription
clientKeystringUnique key of your account

Returns

RecaptchaV3Task

Overrides

CapmonsterClient.constructor

Defined in

src/tasks/recaptcha_v3.ts:8

Properties

clientKey

clientKey: string

Inherited from

CapmonsterClient.clientKey

Defined in

src/capmonster.ts:6

Methods

convertCookies

convertCookies(cookies): string

Convert cookies to string

Parameters

NameTypeDescription
cookiesObjectYour cookies as a object

Returns

string

Since

v0.4

Inherited from

CapmonsterClient.convertCookies

Defined in

src/capmonster.ts:53


createTask

createTask(websiteUrl, websiteKey, minimumScore?, pageAction?, noCache?): Promise<number>

Create task

Parameters

NameTypeDescription
websiteUrlstringAddress of a webpage with Google ReCaptcha
websiteKeystringRecaptcha website key.
minimumScore?numberValue between 0.1 to 0.9
pageAction?stringWidget action value. Website owner defines what user is doing on the page through this parameter. Default value: verify
noCache?boolean

Returns

Promise<number>

ID of the created task

Deprecated

since v0.4 - use task & createWithTask instead

Defined in

src/tasks/recaptcha_v3.ts:24


createWithTask

createWithTask(task): Promise<number>

Creates a recaptcha v3 task for solving

Parameters

NameTypeDescription
taskOmit<IRecaptchaV3TaskRequest, "type">task

Returns

Promise<number>

ID of the created task

Defined in

src/tasks/recaptcha_v3.ts:58


getBalance

getBalance(): Promise<number>

Returns

Promise<number>

Balance of your account

Inherited from

CapmonsterClient.getBalance

Defined in

src/capmonster.ts:35


getTaskResult

getTaskResult(taskId): Promise<null | IRecaptchaV3TaskResponse>

Get task result

Parameters

NameTypeDescription
taskIdnumberTask id which returns from createWithTask function.

Returns

Promise<null | IRecaptchaV3TaskResponse>

Returns the solution if captcha is solved, otherwise null

Also

see joinTaskResult

Defined in

src/tasks/recaptcha_v3.ts:74


joinTaskResult

joinTaskResult(taskId, timeout?): Promise<IRecaptchaV3TaskResponse>

Get task result. This function is waits until task to be solved.

Parameters

NameTypeDescription
taskIdnumberTask id which returns from createWithTask function.
timeout?number(as seconds) Sets the timeout for the current execution of this function.

Returns

Promise<IRecaptchaV3TaskResponse>

Solution of the task

Throws

CapmonsterError, if task can't be solved in maximum time

Also

see getTaskResult

Defined in

src/tasks/recaptcha_v3.ts:85


setCallbackUrl

setCallbackUrl(url): void

Sets the callback url for all tasks, globally.

Contents are sent by POST request and are same to the contents. of getTaskResult method. The content of the response is not checked and you must accept the request in 2 seconds then the connection will be closed.

Parameters

NameTypeDescription
urlstringWeb address where we will send result of captcha task processing.

Returns

void

Inherited from

CapmonsterClient.setCallbackUrl

Defined in

src/capmonster.ts:73


setTimeout

setTimeout(timeout): void

Sets the timeout for the entire client.

Parameters

NameTypeDescription
timeoutnumberAs seconds, must between 1 and 300.

Returns

void

Inherited from

CapmonsterClient.setTimeout

Defined in

src/capmonster.ts:86


task

task(task): Omit<IRecaptchaV3TaskRequest, "type">

Creates only the task configuration for reuseable tasks.

Parameters

NameTypeDescription
taskOmit<IRecaptchaV3TaskRequest, "type">IRecaptchaV3TaskRequest

Returns

Omit<IRecaptchaV3TaskRequest, "type">

Only the task you created IRecaptchaV3TaskRequest

Since

v0.4

Defined in

src/tasks/recaptcha_v3.ts:51


unsetCallbackUrl

unsetCallbackUrl(): void

Unset the callback url for all tasks, globally.

Returns

void

Inherited from

CapmonsterClient.unsetCallbackUrl

Defined in

src/capmonster.ts:80