mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
Added FlareSolverr fro 1337x
This commit is contained in:
@@ -53,3 +53,8 @@ services:
|
||||
volumes:
|
||||
mongo-data:
|
||||
postgres-data:
|
||||
flaresolverr:
|
||||
image: ghcr.io/flaresolverr/flaresolverr:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 8191:8191
|
||||
@@ -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') ||
|
||||
|
||||
Reference in New Issue
Block a user