Class: RecaptchaV2Task
Hierarchy
-
UAProxy
↳
RecaptchaV2Task
Constructors
constructor
• new RecaptchaV2Task(clientKey
): RecaptchaV2Task
Initialize a new RecaptchaV2Task for handling the captchas
Parameters
Name | Type | Description |
---|---|---|
clientKey | string | Unique key of your account |
Returns
Overrides
UAProxy.constructor
Defined in
Properties
clientKey
• clientKey: string
Inherited from
UAProxy.clientKey
Defined in
Methods
convertCookies
▸ convertCookies(cookies
): string
Convert cookies to string
Parameters
Name | Type | Description |
---|---|---|
cookies | Object | Your cookies as a object |
Returns
string
Since
v0.4
Inherited from
UAProxy.convertCookies
Defined in
createTask
▸ createTask(websiteUrl
, websiteKey
, cookies?
, recaptchaSValue?
, noCache?
): Promise
<number
>
Create task
Parameters
Name | Type |
---|---|
websiteUrl | string |
websiteKey | string |
cookies? | string | object | unknown [] |
recaptchaSValue? | string |
noCache? | boolean |
Returns
Promise
<number
>
ID of the created task
Deprecated
since v0.4 - use task & createWithTask instead
Defined in
createWithTask
▸ createWithTask(task
): Promise
<number
>
Creates a recaptchav2 task for solving
Parameters
Name | Type | Description |
---|---|---|
task | Omit <IRecaptchaV2TaskRequest , "type" > | task |
Returns
Promise
<number
>
ID of the created task
Since
v0.4
Defined in
disableProxy
▸ disableProxy(): void
Disables (by deleting the proxy instance) proxy.
Returns
void
Deprecated
since v0.4 - use resetProxy
instead
Inherited from
UAProxy.disableProxy
Defined in
getBalance
▸ getBalance(): Promise
<number
>
Returns
Promise
<number
>
Balance of your account
Inherited from
UAProxy.getBalance
Defined in
getTaskResult
▸ getTaskResult(taskId
): Promise
<null
| IRecaptchaV2TaskResponse
>
Get task result
Parameters
Name | Type | Description |
---|---|---|
taskId | number | Task id which returns from createWithTask function. |
Returns
Promise
<null
| IRecaptchaV2TaskResponse
>
Returns the solution if captcha is solved, otherwise null
Also
see joinTaskResult
Defined in
joinTaskResult
▸ joinTaskResult(taskId
, timeout?
): Promise
<IRecaptchaV2TaskResponse
>
Get task result. This function is waits until task to be solved.
Parameters
Name | Type | Description |
---|---|---|
taskId | number | Task id which returns from createWithTask function. |
timeout? | number | (as seconds) Sets the timeout for the current execution of this function. |
Returns
Promise
<IRecaptchaV2TaskResponse
>
Solution of the task
Throws
CapmonsterError, if task can't be solved in maximum time
Also
see getTaskResult
Defined in
resetUserAgent
▸ resetUserAgent(): void
Resets the global user agent if any.
Returns
void
Deprecated
since v0.4
Inherited from
UAProxy.resetUserAgent
Defined in
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
Name | Type | Description |
---|---|---|
url | string | Web address where we will send result of captcha task processing. |
Returns
void
Inherited from
UAProxy.setCallbackUrl
Defined in
setGlobalProxy
▸ setGlobalProxy(proxy
): WithRequired
<IProxyTaskRequest
, "proxyType"
| "proxyAddress"
| "proxyPort"
>
Sets the proxy for using in tasks which supports.
Parameters
Name | Type | Description |
---|---|---|
proxy | WithRequired <IProxyTaskRequest , "proxyType" | "proxyAddress" | "proxyPort" > | Proxy |
Returns
WithRequired
<IProxyTaskRequest
, "proxyType"
| "proxyAddress"
| "proxyPort"
>
Since
v0.4
Inherited from
UAProxy.setGlobalProxy
Defined in
setProxy
▸ setProxy(proxyType
, proxyAddress
, proxyPort
, proxyLogin?
, proxyPassword?
): void
Sets the proxy for using in tasks which supports.
Parameters
Name | Type | Description |
---|---|---|
proxyType | ProxyType | Type of the proxy |
proxyAddress | string | Proxy IP address IPv4/IPv6 |
proxyPort | number | Proxy port |
proxyLogin? | string | Login for proxy which requires authorizaiton (basic) |
proxyPassword? | string | Proxy password |
Returns
void
Deprecated
since v0.4 - use setGlobalProxy
Inherited from
UAProxy.setProxy
Defined in
setTimeout
▸ setTimeout(timeout
): void
Sets the timeout for the entire client.
Parameters
Name | Type | Description |
---|---|---|
timeout | number | As seconds, must between 1 and 300. |
Returns
void
Inherited from
UAProxy.setTimeout
Defined in
setUserAgent
▸ setUserAgent(userAgent
): void
Sets a global user agent for using in tasks which supports user agent
Parameters
Name | Type | Description |
---|---|---|
userAgent | string | Browser's User-Agent which is used in emulation. |
Returns
void
Inherited from
UAProxy.setUserAgent
Defined in
task
▸ task(task
): Omit
<IRecaptchaV2TaskRequest
, "type"
>
Creates only the task configuration for reuseable tasks.
Parameters
Name | Type | Description |
---|---|---|
task | Omit <IRecaptchaV2TaskRequest , "type" > | IRecaptchaV2TaskRequest |
Returns
Omit
<IRecaptchaV2TaskRequest
, "type"
>
Only the task you created IRecaptchaV2TaskRequest
Since
v0.4
Defined in
unsetCallbackUrl
▸ unsetCallbackUrl(): void
Unset the callback url for all tasks, globally.
Returns
void
Inherited from
UAProxy.unsetCallbackUrl
Defined in
unsetProxy
▸ unsetProxy(): void
Resets the proxy if any
Returns
void
Since
v0.4
Inherited from
UAProxy.unsetProxy
Defined in
unsetUserAgent
▸ unsetUserAgent(): void
Resets the global user agent if any.
Returns
void
Inherited from
UAProxy.unsetUserAgent