9kw Captcha object constructor Supports solving of Captcha Types:
- Image
- reCaptcha v2
- reCaptcha v3
- Captcha URL
- Base64 Captcha
Methods
# async asyncGetSolution(captchaID)
Get the solution of that captcha id The callback is called with err, solution where solution can be a string or empty string if no solution yet this method should be called until there is a solution ex: every 3 seconds
Parameters:
Name | Type | Description |
---|---|---|
captchaID |
String |
# async asyncGetSolutionLoop(captchaID, timeoutopt)
Get the captcha solution Tries to get the solution before the timeout every 3 seconds If timeout, Promise will reject with error If solution, Promise will resolve with with solution
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
captchaID |
String | |||
timeout |
Number |
<optional> |
30 | seconds to giveup (30 is a good number) |
# async asyncIsCorrect(captchaID, isCorrectopt)
Say to 9kw if the captcha solution you got from the getSolution method is correct or incorrect Promise can resolve with response.text Promise can reject with error
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
captchaID |
String | |||
isCorrect |
Boolean |
<optional> |
false |
# async asyncServerCheck()
Get the server info If there is an error Promise will reject with error If successful Promise will resolve with res.text
# async asyncSubmit(imageUrlOrSiteKey, siteUrlopt)
Submit the captcha (Image, Audio or Site Key) - Async Promise will resolve with err or captchaID where the captchaID is an integer
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
imageUrlOrSiteKey |
String | Path to the image or siteKey (for siteKey solve the siteUrl must be set) |
|
siteUrl |
String |
<optional> |
URL of the site containing recaptcha (required for siteKey solve) |
# async asyncSubmitBase64(data)
Submit the captcha (Base64) Promise will resolve with err, captchaID where the captchaID is an integer
Parameters:
Name | Type | Description |
---|---|---|
data |
String | Base64 string |
# async asyncSubmitFile(pathToFile, siteUrlopt, priorityopt)
Submit the captcha File (Image or Audio) - Async Promise will resolve with err or captchaID where the captchaID is an integer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pathToFile |
String | Path to the image or siteKey (for siteKey solve the siteUrl must be set) |
||
siteUrl |
String |
<optional> |
URL of the site containing recaptcha (required for siteKey solve) |
|
priority |
Number |
<optional> |
process.env.CAPTCHA_PRIO_9KW | Overwrite the priority from API. Usefull to have different priorities for different captchas in the same environment. |
# getBalance(callback)
Get the user balance
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Needs to handle err<Object|String|null>, response |
# getSolution(captchaID, callback)
Get the solution of that captcha id The callback is called with err, solution where solution can be a string or empty string if no solution yet this method should be called until there is a solution ex: every 3 seconds
Parameters:
Name | Type | Description |
---|---|---|
captchaID |
String | |
callback |
function | Needs to handle err<Object|String|null>, solution<Object|String> |
# getSolutionLoop(captchaID, callback, timeoutopt)
Get the captcha solution Tries to get the solution before the timeout every 3 seconds If timeout, callback is called with error If solution, callback is called with null, solution
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
captchaID |
String | |||
callback |
function | Needs to handle err<Object|String|null>, solution<Object|String> |
||
timeout |
Number |
<optional> |
30 | seconds to giveup (30 is a good number) |
# isCorrect(captchaID, isCorrectopt, optionalCallbackopt)
Say to 9kw if the captcha solution you got from the getSolution method is correct or incorrect
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
captchaID |
String | |||
isCorrect |
Boolean |
<optional> |
false | |
optionalCallback |
function |
<optional> |
Needs to handle err<Object|String|null>, resText |
# serverCheck(callback)
Get the server info
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Needs to handle err<Object|String|null>, serverinfoString |
# submit(imageUrlOrSiteKey, callback, siteUrlopt, priorityopt)
Submit the captcha (Image/Audio URL or Site Key) Callback will receive err, captchaID where the captchaID is an integer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
imageUrlOrSiteKey |
String | Path to the image or siteKey |
||
callback |
function | Needs to handle err<Object|String|null>, response<Object|String> |
||
siteUrl |
String |
<optional> |
URL of the site containing recaptcha |
|
priority |
Number |
<optional> |
process.env.CAPTCHA_PRIO_9KW | Optional overwrite the priority from API. Usefull to have different priorities for different captchas in the same environment. |
# submitBase64(data, callback)
Submit the captcha (Base64) Callback will receive err, captchaID where the captchaID is an integer
Parameters:
Name | Type | Description |
---|---|---|
data |
String | Base64 string |
callback |
function | Needs to handle err<Object|String|null>, response<Object|String> |
# submitFile(pathToFile, callback, siteUrlopt, priorityopt)
Submit the captcha File (Image or Audio) Callback will receive err, captchaID where the captchaID is an integer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pathToFile |
String | Path to the image or siteKey |
||
callback |
function | Needs to handle err<Object|String|null>, response<Object|String> |
||
siteUrl |
String |
<optional> |
URL of the site containing recaptcha |
|
priority |
Number |
<optional> |
process.env.CAPTCHA_PRIO_9KW | Overwrite the priority from API. Usefull to have different priorities for different captchas in the same environment. |