catch error for 2captcha
This commit is contained in:
@@ -39,17 +39,18 @@ class SolveCaptcha {
|
||||
status_code = status;
|
||||
solution = sol
|
||||
})
|
||||
await delay(5 * 1000)
|
||||
}
|
||||
handle_solution_received(solution)
|
||||
}
|
||||
|
||||
async get_solution(catcha_id, onSolutionFound) {
|
||||
|
||||
console.log("get_solution() called")
|
||||
try {
|
||||
let url_response = `http://2captcha.com/res.php?key=${API_KEY}&action=get&id=${catcha_id}`;
|
||||
let res = await axios.get(url_response)
|
||||
console.log(`statusCode: ${res.status}`);
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
let results = res.data.split("|");
|
||||
let solution
|
||||
if (results.length > 1)
|
||||
@@ -59,6 +60,11 @@ class SolveCaptcha {
|
||||
}
|
||||
onSolutionFound(res.status, solution)
|
||||
await delay(5 * 1000)
|
||||
} catch (e) {
|
||||
onSolutionFound(1, CAPCHA_NOT_READY)
|
||||
await delay(5 * 1000)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user