This commit is contained in:
spiduler
2020-11-07 18:35:07 +09:00
parent 9981411815
commit 5531783551

View File

@@ -95,13 +95,15 @@ class CaptchaComp {
} }
resolveCaptcha(driver) { resolveCaptcha(driver) {
return this.api.working ? new Promise(r => r(new Error('Resovling Catpcha'))) : this.requestResolve(driver) if (this.api.working === false) {
.then(id => this.getAnswer(id)) return this.api.working ? new Promise(r => r(new Error('Resovling Catpcha'))) : this.requestResolve(driver)
.then(res => { .then(id => this.getAnswer(id))
setTimeout(() => { this.api.working = false }, 1000 * 5 * 2) .then(res => {
logger.info({ result: res.request }, 'Calling captchaCallback') setTimeout(() => { this.api.working = false }, 1000 * 5 * 2)
return driver.executeScript('captchaCallback("' + res.request + '")').then(() => this.sleep(1000 * 5)) logger.info({ result: res.request }, 'Calling captchaCallback')
}) return driver.executeScript('captchaCallback("' + res.request + '")').then(() => this.sleep(1000 * 5))
})
}
} }
} }