mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-01-11 22:40:22 +00:00
handle too big entry for debridlink
This commit is contained in:
parent
f779292130
commit
1a9b2ba4f7
1 changed files with 19 additions and 3 deletions
|
|
@ -63,10 +63,18 @@ export async function resolve({ ip, apiKey, infoHash, fileIndex }) {
|
||||||
|
|
||||||
return _resolve(DL, infoHash, fileIndex)
|
return _resolve(DL, infoHash, fileIndex)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (errorExpiredSubscriptionError(error)) {
|
if (isAccessDeniedError(error)) {
|
||||||
console.log(`Access denied to DebridLink ${infoHash} [${fileIndex}]`);
|
console.log(`Access denied to DebridLink ${infoHash} [${fileIndex}]`);
|
||||||
return StaticResponse.FAILED_ACCESS;
|
return StaticResponse.FAILED_ACCESS;
|
||||||
}
|
}
|
||||||
|
if (isLimitsExceededError(error)) {
|
||||||
|
console.log(`Limits exceeded in DebridLink ${infoHash} [${fileIndex}]`);
|
||||||
|
return StaticResponse.LIMITS_EXCEEDED;
|
||||||
|
}
|
||||||
|
if (isTorrentTooBigError(error)) {
|
||||||
|
console.log(`Torrent too big for DebridLink ${infoHash} [${fileIndex}]`);
|
||||||
|
return StaticResponse.FAILED_TOO_BIG;
|
||||||
|
}
|
||||||
return Promise.reject(`Failed DebridLink adding torrent ${JSON.stringify(error)}`);
|
return Promise.reject(`Failed DebridLink adding torrent ${JSON.stringify(error)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -135,6 +143,14 @@ function statusReady(torrent) {
|
||||||
return torrent.downloadPercent === 100;
|
return torrent.downloadPercent === 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
function errorExpiredSubscriptionError(error) {
|
function isAccessDeniedError(error) {
|
||||||
return ['freeServerOverload', 'maxTorrent', 'maxLink', 'maxLinkHost', 'maxData', 'maxDataHost'].includes(error);
|
return ['badToken', 'accountLocked'].includes(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLimitsExceededError(error) {
|
||||||
|
return ['freeServerOverload', 'maxTorrent', 'maxLink', 'maxLinkHost', 'maxData', 'maxDataHost', 'floodDetected'].includes(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isTorrentTooBigError(error) {
|
||||||
|
return ['torrentTooBig'].includes(error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue