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