mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-03-11 17:15:37 +00:00
handle too big entry for all debrid
This commit is contained in:
parent
2003debe37
commit
f779292130
2 changed files with 11 additions and 3 deletions
|
|
@ -83,14 +83,17 @@ export async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex
|
||||||
|
|
||||||
async function _resolve(AD, infoHash, cachedEntryInfo, fileIndex) {
|
async function _resolve(AD, infoHash, cachedEntryInfo, fileIndex) {
|
||||||
const torrent = await _createOrFindTorrent(AD, infoHash);
|
const torrent = await _createOrFindTorrent(AD, infoHash);
|
||||||
if (torrent && statusReady(torrent.statusCode)) {
|
if (statusReady(torrent?.statusCode)) {
|
||||||
return _unrestrictLink(AD, torrent, cachedEntryInfo, fileIndex);
|
return _unrestrictLink(AD, torrent, cachedEntryInfo, fileIndex);
|
||||||
} else if (torrent && statusDownloading(torrent.statusCode)) {
|
} else if (statusDownloading(torrent?.statusCode)) {
|
||||||
console.log(`Downloading to AllDebrid ${infoHash} [${fileIndex}]...`);
|
console.log(`Downloading to AllDebrid ${infoHash} [${fileIndex}]...`);
|
||||||
return StaticResponse.DOWNLOADING;
|
return StaticResponse.DOWNLOADING;
|
||||||
} else if (torrent && statusHandledError(torrent.statusCode)) {
|
} else if (statusHandledError(torrent?.statusCode)) {
|
||||||
console.log(`Retrying downloading to AllDebrid ${infoHash} [${fileIndex}]...`);
|
console.log(`Retrying downloading to AllDebrid ${infoHash} [${fileIndex}]...`);
|
||||||
return _retryCreateTorrent(AD, infoHash, cachedEntryInfo, fileIndex);
|
return _retryCreateTorrent(AD, infoHash, cachedEntryInfo, fileIndex);
|
||||||
|
} else if (statusTooBigEntry(torrent?.statusCode)) {
|
||||||
|
console.log(`Torrent too big for AllDebrid ${infoHash} [${fileIndex}]`);
|
||||||
|
return StaticResponse.FAILED_TOO_BIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(`Failed AllDebrid adding torrent ${JSON.stringify(torrent)}`);
|
return Promise.reject(`Failed AllDebrid adding torrent ${JSON.stringify(torrent)}`);
|
||||||
|
|
@ -182,6 +185,10 @@ function statusReady(statusCode) {
|
||||||
return statusCode === 4;
|
return statusCode === 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function statusTooBigEntry(statusCode) {
|
||||||
|
return statusCode === 8;
|
||||||
|
}
|
||||||
|
|
||||||
function isExpiredSubscriptionError(error) {
|
function isExpiredSubscriptionError(error) {
|
||||||
return ['AUTH_BAD_APIKEY', 'MUST_BE_PREMIUM', 'MAGNET_MUST_BE_PREMIUM', 'FREE_TRIAL_LIMIT_REACHED', 'AUTH_USER_BANNED']
|
return ['AUTH_BAD_APIKEY', 'MUST_BE_PREMIUM', 'MAGNET_MUST_BE_PREMIUM', 'FREE_TRIAL_LIMIT_REACHED', 'AUTH_USER_BANNED']
|
||||||
.includes(error.code);
|
.includes(error.code);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const staticVideoUrls = {
|
||||||
FAILED_DOWNLOAD: `videos/download_failed_v2.mp4`,
|
FAILED_DOWNLOAD: `videos/download_failed_v2.mp4`,
|
||||||
FAILED_ACCESS: `videos/failed_access_v2.mp4`,
|
FAILED_ACCESS: `videos/failed_access_v2.mp4`,
|
||||||
FAILED_RAR: `videos/failed_rar_v2.mp4`,
|
FAILED_RAR: `videos/failed_rar_v2.mp4`,
|
||||||
|
FAILED_TOO_BIG: 'failed_too_big_v1.mp4',
|
||||||
FAILED_OPENING: `videos/failed_opening_v2.mp4`,
|
FAILED_OPENING: `videos/failed_opening_v2.mp4`,
|
||||||
FAILED_UNEXPECTED: `videos/failed_unexpected_v2.mp4`,
|
FAILED_UNEXPECTED: `videos/failed_unexpected_v2.mp4`,
|
||||||
FAILED_INFRINGEMENT: `videos/failed_infringement_v2.mp4`,
|
FAILED_INFRINGEMENT: `videos/failed_infringement_v2.mp4`,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue