sdfdsf
This commit is contained in:
@@ -37,7 +37,7 @@ class CaptchaComp {
|
||||
|
||||
getUrl(params) {
|
||||
if (params.id) {
|
||||
let params = Object.assign(this.params.res, { id: id })
|
||||
let params = Object.assign(this.params.res, { id: params.id })
|
||||
let o = new url.URL(this.api.res)
|
||||
o.search = new url.URLSearchParams(params).toString();
|
||||
return o
|
||||
@@ -74,13 +74,14 @@ class CaptchaComp {
|
||||
})
|
||||
})
|
||||
}).then(id => {
|
||||
logger.info({ id: this.api.id }, 'Request answer delay for 20 senconds')
|
||||
logger.info({ id: id }, 'Request answer delay for 20 senconds')
|
||||
return new Promise(r => setTimeout(() => r(id), 20000))
|
||||
})
|
||||
}
|
||||
|
||||
async getAnswer(res) {
|
||||
async getAnswer(id) {
|
||||
let retryLimit = 10
|
||||
let res = await this.request({ id: id })
|
||||
while (res.request == 'CAPCHA_NOT_READY') {
|
||||
await this.sleep(this.api.retryTimeout)
|
||||
retryLimit = retryLimit - 1
|
||||
@@ -93,8 +94,7 @@ class CaptchaComp {
|
||||
|
||||
resolveCaptcha(driver) {
|
||||
return this.requestResolve(driver)
|
||||
.then(id => this.request({ id: id }))
|
||||
.then(res => this.getAnswer(res))
|
||||
.then(id => this.getAnswer(id))
|
||||
.then(res => {
|
||||
return driver.executeScript('captchaCallback("' + res.request + '")').then(() => this.sleep(1000 * 5))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user