mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-04-20 10:02:04 +00:00
[scrapper] fixes rarbg api error handling
This commit is contained in:
parent
df03480b83
commit
12dc20c144
1 changed files with 2 additions and 2 deletions
|
|
@ -102,11 +102,11 @@ async function singleRequest(params = {}, config = {}, retries = 5) {
|
|||
token = undefined;
|
||||
return singleRequest(params, config);
|
||||
}
|
||||
if ((!response.body || [5, 20].includes(response.body.error_code)) && retries > 0) {
|
||||
if ((!response.body || !response.body.length || [5, 20].includes(response.body.error_code)) && retries > 0) {
|
||||
// too many requests
|
||||
return Promises.delay(2100).then(() => singleRequest(params, config, retries - 1));
|
||||
}
|
||||
if (response.statusCode !== 200) {
|
||||
if (response.statusCode !== 200 || (response.body && response.body.error)) {
|
||||
// something went wrong
|
||||
return Promise.reject(response.body || `Failed RARGB request with status=${response.statusCode}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue