Merge pull request #15 from KillTrot/master

Add FlareSolverr fro 1337x
This commit is contained in:
Gabisonfire
2024-01-29 10:49:30 -05:00
committed by GitHub
2 changed files with 15 additions and 2 deletions

View File

@@ -49,6 +49,12 @@ services:
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_USER=postgres
- POSTGRES_DB=torrentio
flaresolverr:
image: ghcr.io/flaresolverr/flaresolverr:latest
restart: unless-stopped
ports:
- 8191:8191
volumes:
mongo-data:

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') ||