fix(fetcher): improve Flaresolverr fetching

- use queued fetching to not mix sessions
- log issue responses
This commit is contained in:
WebStreamr 2025-06-04 14:59:12 +00:00
parent 7c45c78788
commit 2c9faebcdc
No known key found for this signature in database

View file

@ -82,8 +82,9 @@ export class Fetcher {
this.logger.info(`Query FlareSolverr for ${url.href}`, ctx);
const body = { cmd: 'request.get', url: url.href, session: 'default' };
const challengeResult = await (await fetch(new URL(flareSolverrEndpoint), { method: 'POST', body: JSON.stringify(body), headers: { 'Content-Type': 'application/json' } })).json();
const challengeResult = await (await this.queuedFetch(ctx, new URL(flareSolverrEndpoint), { method: 'POST', body: JSON.stringify(body), headers: { 'Content-Type': 'application/json' } })).json();
if (challengeResult.status !== 'ok') {
this.logger.warn(`FlareSolverr issue: ${JSON.stringify(challengeResult)}`, ctx);
throw new BlockedError('flaresolverr_failed', {});
}