Skip to main content

Class: AmazonTask

Hierarchy

  • UAProxy

    AmazonTask

Constructors

constructor

new AmazonTask(clientKey): AmazonTask

Initialize a new AmazonTask for handling the captchas

Parameters

NameTypeDescription
clientKeystringUnique key of your account

Returns

AmazonTask

Since

v0.4.4

Overrides

UAProxy.constructor

Defined in

src/tasks/aws_waf.ts:9

Properties

clientKey

clientKey: string

Inherited from

UAProxy.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

UAProxy.convertCookies

Defined in

src/capmonster.ts:53


createWithTask

createWithTask(task): Promise<number>

Creates a aws waf captcha task for solving

Parameters

NameTypeDescription
taskOmit<IAmazonTaskRequest, "type">task

Returns

Promise<number>

ID of the created task

Since

v0.4.4

Defined in

src/tasks/aws_waf.ts:19


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

src/capmonster.ts:255


getBalance

getBalance(): Promise<number>

Returns

Promise<number>

Balance of your account

Inherited from

UAProxy.getBalance

Defined in

src/capmonster.ts:35


getTaskResult

getTaskResult(taskId): Promise<null | IAmazonTaskResponse>

Get task result

Parameters

NameTypeDescription
taskIdnumberTask id which returns from createWithTask function.

Returns

Promise<null | IAmazonTaskResponse>

Returns the solution if captcha is solved, otherwise null

Also

see joinTaskResult

Defined in

src/tasks/aws_waf.ts:44


joinTaskResult

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

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<IAmazonTaskResponse>

Solution of the task

Throws

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

Also

see getTaskResult

Defined in

src/tasks/aws_waf.ts:55


resetUserAgent

resetUserAgent(): void

Resets the global user agent if any.

Returns

void

Deprecated

since v0.4

Inherited from

UAProxy.resetUserAgent

Defined in

src/capmonster.ts:197


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

UAProxy.setCallbackUrl

Defined in

src/capmonster.ts:73


setGlobalProxy

setGlobalProxy(proxy): WithRequired<IProxyTaskRequest, "proxyType" | "proxyAddress" | "proxyPort">

Sets the proxy for using in tasks which supports.

Parameters

NameTypeDescription
proxyWithRequired<IProxyTaskRequest, "proxyType" | "proxyAddress" | "proxyPort">Proxy

Returns

WithRequired<IProxyTaskRequest, "proxyType" | "proxyAddress" | "proxyPort">

Since

v0.4

Inherited from

UAProxy.setGlobalProxy

Defined in

src/capmonster.ts:244


setProxy

setProxy(proxyType, proxyAddress, proxyPort, proxyLogin?, proxyPassword?): void

Sets the proxy for using in tasks which supports.

Parameters

NameTypeDescription
proxyTypeProxyTypeType of the proxy
proxyAddressstringProxy IP address IPv4/IPv6
proxyPortnumberProxy port
proxyLogin?stringLogin for proxy which requires authorizaiton (basic)
proxyPassword?stringProxy password

Returns

void

Deprecated

since v0.4 - use setGlobalProxy

Inherited from

UAProxy.setProxy

Defined in

src/capmonster.ts:220


setTimeout

setTimeout(timeout): void

Sets the timeout for the entire client.

Parameters

NameTypeDescription
timeoutnumberAs seconds, must between 1 and 300.

Returns

void

Inherited from

UAProxy.setTimeout

Defined in

src/capmonster.ts:86


setUserAgent

setUserAgent(userAgent): void

Sets a global user agent for using in tasks which supports user agent

Parameters

NameTypeDescription
userAgentstringBrowser's User-Agent which is used in emulation.

Returns

void

Inherited from

UAProxy.setUserAgent

Defined in

src/capmonster.ts:187


task

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

Creates only the task configuration for reuseable tasks.

Parameters

NameTypeDescription
taskOmit<IAmazonTaskRequest, "type">IAmazonTaskRequest

Returns

Omit<IAmazonTaskRequest, "type">

Only the task you created IAmazonTaskRequest

Since

v0.4.4

Defined in

src/tasks/aws_waf.ts:36


unsetCallbackUrl

unsetCallbackUrl(): void

Unset the callback url for all tasks, globally.

Returns

void

Inherited from

UAProxy.unsetCallbackUrl

Defined in

src/capmonster.ts:80


unsetProxy

unsetProxy(): void

Resets the proxy if any

Returns

void

Since

v0.4

Inherited from

UAProxy.unsetProxy

Defined in

src/capmonster.ts:266


unsetUserAgent

unsetUserAgent(): void

Resets the global user agent if any.

Returns

void

Inherited from

UAProxy.unsetUserAgent

Defined in

src/capmonster.ts:207