Update reCaptcha solving examples
parent
e5428dbd8e
commit
02e55d3e44
|
@ -8,7 +8,7 @@ const cloudscraper = require('../..').defaults({ onCaptcha: handler, headers });
|
|||
function handler (options, { captcha }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Here you do some magic with the siteKey provided by cloudscraper
|
||||
console.error('The url is "' + captcha.url + '"');
|
||||
console.error('The url is "' + captcha.uri.href + '"');
|
||||
console.error('The site key is "' + captcha.siteKey + '"');
|
||||
// captcha.form['g-recaptcha-response'] = /* Obtain from your service */
|
||||
reject(new Error('This is a dummy function.'));
|
||||
|
@ -16,9 +16,9 @@ function handler (options, { captcha }) {
|
|||
}
|
||||
|
||||
// An example handler with destructuring arguments
|
||||
function alternative (options, { captcha: { url, siteKey } }) {
|
||||
function alternative (options, { captcha: { uri, siteKey } }) {
|
||||
// Here you do some magic with the siteKey provided by cloudscraper
|
||||
console.error('The url is "' + url + '"');
|
||||
console.error('The url is "' + uri.href + '"');
|
||||
console.error('The site key is "' + siteKey + '"');
|
||||
return Promise.reject(new Error('This is a dummy function'));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ function solveReCAPTCHA (url, sitekey, callback) {
|
|||
function onCaptcha (options, response, body) {
|
||||
const captcha = response.captcha;
|
||||
// solveReCAPTCHA is a method that you should come up with and pass it href and sitekey, in return it will return you a reponse
|
||||
solveReCAPTCHA(response.request.uri.href, captcha.siteKey, (error, gRes) => {
|
||||
solveReCAPTCHA(captcha.uri.href, captcha.siteKey, (error, gRes) => {
|
||||
// eslint-disable-next-line no-void
|
||||
if (error) return void captcha.submit(error);
|
||||
captcha.form['g-recaptcha-response'] = gRes;
|
||||
|
|
Loading…
Reference in New Issue