Closed SFx2018 closed 4 years ago
You should try this for captcha solving : https://github.com/codemanki/cloudscraper/blob/master/docs/examples/solve-recaptcha.js
could someone help me to fix current code, I don't want to re-work whole code to use solve-recaptcha.js
function gotError(error) {
if (error instanceof CaptchaError) {
log(`Prompted for ReCAPTCHA. Solving...`);
const { options } = error;
const body = error.response.body.toString(`utf8`);
const $ = cheerio.load(body);
const sitekey = $(`[data-sitekey]`).data(`sitekey`);
const query = {};
$(`#challenge-form`).serializeArray().forEach((input) => query[input.name] = input.value);
solveReCAPTCHA(options.uri, sitekey, (error, captcharesponse) => {
if (error) {
gotError(error);
return;
}
query[`g-recaptcha-response`] = captcharesponse;
cf({
"uri": `https://ogusers.com/cdn-cgi/l/chk_captcha`,
"qs": query,
"followAllRedirects": true,
"method": `GET`
}).then(() => cf(options).then(options.cb).catch(gotError)).catch(gotError);
});
return;
}
let errmsg;
if (error.response && error.response.body && error.response.body.includes(`Board Message`)) {
const $ = cheerio.load(error.response.body);
errmsg = $(`col_row`).text().trim();
}
log(`Something went wrong: ${errmsg ? errmsg : `${error.name || error.message}${error.statusCode ? ` (${error.statusCode})` : ``}`}${error.options ? ` @ '${error.options.uri}'` : ``}`);
}
Closing as this is not related to the cloudscraper.
Hello, I was using this code: https://github.com/codemanki/cloudscraper/issues/62#issuecomment-482880177
to resolve captcha with anti-captcha service on ogusers forum since new update of this library
I tried to change url by adding
$("#challenge-form").attr('action');
this variable to url, and changed method to POST but doesn't work.Please help (: