mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-01-11 22:40:22 +00:00
handle more statuses for torbox to return correct responses
This commit is contained in:
parent
4c50c505ed
commit
2003debe37
2 changed files with 7 additions and 3 deletions
|
|
@ -168,7 +168,7 @@ export function toCommonError(error) {
|
|||
}
|
||||
|
||||
function statusDownloading(torrent) {
|
||||
return ['downloading', 'created'].includes(torrent.status);
|
||||
return ['downloading', 'created', 'queued'].includes(torrent.status);
|
||||
}
|
||||
|
||||
function statusError(torrent) {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,9 @@ async function _unrestrictLink(apiKey, infoHash, torrent, cachedEntryInfo, fileI
|
|||
|| videos[0];
|
||||
|
||||
if (!targetVideo) {
|
||||
if (torrent.files.every(file => file.zipped)) {
|
||||
return StaticResponse.FAILED_RAR;
|
||||
}
|
||||
return Promise.reject(`No TorBox file found for index ${fileIndex} in: ${JSON.stringify(torrent)}`);
|
||||
}
|
||||
return getDownloadLink(apiKey, 'torrents', torrent.id, targetVideo.id, ip);
|
||||
|
|
@ -226,11 +229,12 @@ export function toCommonError(data) {
|
|||
}
|
||||
|
||||
function statusDownloading(torrent) {
|
||||
return ['metaDL', 'downloading', 'stalled', 'processing', 'completed'].includes(torrent?.download_state);
|
||||
return ['metaDL', 'downloading', 'stalled (no seeds)', 'processing', 'checking', 'completed']
|
||||
.includes(torrent?.download_state);
|
||||
}
|
||||
|
||||
function statusError(torrent) {
|
||||
return !torrent?.active && !torrent?.download_finished;
|
||||
return (!torrent?.active && !torrent?.download_finished) || torrent?.download_state === 'error';
|
||||
}
|
||||
|
||||
function statusReady(torrent) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue