Added FlareSolverr fro 1337x

This commit is contained in:
Cedric
2024-01-29 09:15:46 -06:00
parent 85af1bb66d
commit 07d4d020e6
2 changed files with 14 additions and 2 deletions

View File

@@ -83,9 +83,16 @@ function singleRequest(requestUrl, config = {}) {
const timeout = config.timeout || defaultTimeout;
const options = { headers: { 'User-Agent': getRandomUserAgent() }, timeout: timeout };
return axios.get(requestUrl, options)
return axios.post('http://flaresolverr:8191/v1', {
cmd: 'request.get',
url: requestUrl,
}, options)
.then((response) => {
const body = response.data;
if (response.data.status !== 'ok'){
throw new Error(`FlareSolverr did not return status 'ok': ${response.data.message}`)
}
const body = response.data.solution.response;
if (!body) {
throw new Error(`No body: ${requestUrl}`);
} else if (body.includes('502: Bad gateway') ||