Error parsing Cloudflare IUAM Javascript challenge.
Trying to use the package on the following json endpoint: https://animepahe.com/api?m=search&l=8&q={searchString}
My code looks like the following:
const got = require('got');
const fetch = require('node-fetch');
const { catchCloudflare } = require('@ctrl/cloudflare');
const { CookieJar } = require('tough-cookie');
async function cloudflareBypass(url, reqOpts) {
const cookieJar = new CookieJar();
const options = {
url,
cookieJar,
retry: 0,
...reqOpts
};
let response = null;
try {
response = await got(options);
} catch (error) {
response = await catchCloudflare(error, options);
}
return response;
}
module.exports = async function myFetch(opts, reqOpts) {
const bypassCloudflare = opts.cloudflare || false;
if (!bypassCloudflare) {
return await fetch(opts.url, { method: 'GET', ...reqOpts });
} else {
return await cloudflareBypass(opts.url, reqOpts);
}
};
It correctly hits the catchCloudflare section of the code but errors with the following error appears:
Error parsing Cloudflare IUAM Javascript challenge. Cloudflare may have changed their technique, or there may be a bug in the script. Check for recent updates then file a bug report at https://github.com/typectrl/cloudflare/issues
yeah cloudflares recent changes make passing the challenge much harder without a browser. I would try something like https://github.com/ngosang/FlareSolverr
@scttcper That is a shame. Thanks for the info though.