@antiadmin/anticaptchaofficial
Advanced tools
Comparing version 1.0.9 to 1.0.10
58
index.js
@@ -22,2 +22,4 @@ | ||
normalWaitingInterval: 2, | ||
isVerbose: true, | ||
taskId: 0 | ||
@@ -28,2 +30,5 @@ }, | ||
}, | ||
shutUp() { | ||
this.settings.isVerbose = false; | ||
}, | ||
getBalance() { | ||
@@ -55,2 +60,3 @@ return new Promise((resolve, reject) => { | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -62,2 +68,12 @@ }) | ||
}, | ||
reportIncorrectImageCaptcha() { | ||
return new Promise((resolve, reject) => { | ||
this.JSONRequest('reportIncorrectImageCaptcha', { | ||
'clientKey' : this.settings.clientKey, | ||
'taskId': this.settings.taskId | ||
}) | ||
.then(resolve) | ||
.catch(err => reject(err)); | ||
}); | ||
}, | ||
@@ -77,2 +93,3 @@ solveRecaptchaV2Proxyless(websiteURL, websiteKey) { | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -118,2 +135,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -145,2 +163,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -155,3 +174,14 @@ }) | ||
reportIncorrectRecaptcha() { | ||
return new Promise((resolve, reject) => { | ||
this.JSONRequest('reportIncorrectRecaptcha', { | ||
'clientKey' : this.settings.clientKey, | ||
'taskId': this.settings.taskId | ||
}) | ||
.then(resolve) | ||
.catch(err => reject(err)); | ||
}); | ||
}, | ||
solveHCaptchaProxyless(websiteURL, websiteKey) { | ||
@@ -168,2 +198,3 @@ return new Promise((resolve, reject) => { | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -205,2 +236,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -232,2 +264,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -270,2 +303,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -303,2 +337,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -347,2 +382,3 @@ }) | ||
.then(res => { | ||
this.settings.taskId = res.taskId; | ||
return this.waitForResult(res.taskId); | ||
@@ -365,4 +401,4 @@ }) | ||
console.log('created task with ID '+taskId); | ||
console.log('waiting '+this.settings.firstAttemptWaitingInterval+' seconds'); | ||
if (this.settings.isVerbose) console.log('created task with ID '+taskId); | ||
if (this.settings.isVerbose) console.log('waiting '+this.settings.firstAttemptWaitingInterval+' seconds'); | ||
await this.delay(this.settings.firstAttemptWaitingInterval * 1000); | ||
@@ -376,9 +412,8 @@ | ||
.then(response => { | ||
if (response.status == 'ready') { | ||
// console.log(response); | ||
taskId = 0 | ||
if (response.status === 'ready') { | ||
taskId = 0; | ||
resolve(response.solution); | ||
} | ||
if (response.status == 'processing') { | ||
console.log('captcha result is not yet ready'); | ||
if (response.status === 'processing') { | ||
if (this.settings.isVerbose) console.log('captcha result is not yet ready'); | ||
} | ||
@@ -392,3 +427,3 @@ }) | ||
console.log('waiting '+this.settings.normalWaitingInterval+' seconds'); | ||
if (this.settings.isVerbose) console.log('waiting '+this.settings.normalWaitingInterval+' seconds'); | ||
await this.delay(this.settings.normalWaitingInterval * 1000); | ||
@@ -424,3 +459,2 @@ | ||
.then(res => { | ||
// console.log('received response, checking for errors'); | ||
return this.checkForErrors(res.data); | ||
@@ -438,9 +472,7 @@ }) | ||
return new Promise((resolve, reject) => { | ||
// console.log('checking this:'); | ||
// console.log(response); | ||
if (typeof response.errorId == "undefined") { | ||
if (typeof response.errorId === "undefined") { | ||
reject("Incorrect API response, something is wrong"); | ||
return; | ||
} | ||
if (typeof response.errorId != "number") { | ||
if (typeof response.errorId !== "number") { | ||
reject("Unknown API error code "+response.errorId); | ||
@@ -447,0 +479,0 @@ return; |
{ | ||
"name": "@antiadmin/anticaptchaofficial", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Official Anti-Captcha.com npm library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,2 +24,7 @@ ## Official Anti-Captcha.com npm module ## | ||
Disable verbose output to console: | ||
```javascript | ||
ac.shutUp(); | ||
``` | ||
Solve Recaptcha V2 without proxy: | ||
@@ -37,2 +42,8 @@ ```javascript | ||
Report last solved Recaptcha v2/v3 as incorrect (must read [this](https://anticaptcha.atlassian.net/wiki/spaces/API/pages/632193041/reportIncorrectRecaptcha+send+complaint+on+a+Recaptcha) before using): | ||
```javascript | ||
ac.reportIncorrectRecaptcha(); | ||
``` | ||
Solve image captcha: | ||
@@ -47,3 +58,8 @@ ```javascript | ||
Report last solved image captcha as incorrect (must read [this](https://anticaptcha.atlassian.net/wiki/spaces/API/pages/48693258/reportIncorrectImageCaptcha+send+complaint+on+an+image+captcha) before using): | ||
```javascript | ||
ac.reportIncorrectImageCaptcha(); | ||
``` | ||
Solve Recaptcha V2 with proxy: | ||
@@ -50,0 +66,0 @@ ```javascript |
25686
9
437
104