bump all-debrid api dependency

This commit is contained in:
TheBeastLT 2026-01-02 18:49:21 +02:00
parent 8665e7590c
commit 2a71e689bc
3 changed files with 20 additions and 10 deletions

View file

@ -135,23 +135,33 @@ async function _createTorrent(AD, infoHash) {
async function _unrestrictLink(AD, torrent, encodedFileName, fileIndex) {
const targetFileName = decodeURIComponent(encodedFileName);
const videos = torrent.links.filter(link => isVideo(link.filename)).sort((a, b) => b.size - a.size);
const files = getNestedFiles(await AD.magnet.files(torrent.id).then(response => response.data.magnets[0].files[0]));
const videos = files.filter(link => isVideo(link.n)).sort((a, b) => b.s - a.s);
const targetVideo = Number.isInteger(fileIndex)
&& videos.find(video => sameFilename(targetFileName, video.filename))
&& videos.find(video => sameFilename(targetFileName, video.n))
|| videos[0];
if (!targetVideo && torrent.links.every(link => isArchive(link.filename))) {
if (!targetVideo && videos.every(link => isArchive(link.n))) {
console.log(`Only AllDebrid archive is available for [${torrent.hash}] ${encodedFileName}`)
return StaticResponse.FAILED_RAR;
}
if (!targetVideo || !targetVideo.link || !targetVideo.link.length) {
if (!targetVideo?.l?.length) {
return Promise.reject(`No AllDebrid links found for [${torrent.hash}] ${encodedFileName}`);
}
const unrestrictedLink = await AD.link.unlock(targetVideo.link).then(response => response.data.link);
const unrestrictedLink = await AD.link.unlock(targetVideo.l).then(response => response.data.link);
console.log(`Unrestricted AllDebrid ${torrent.hash} [${fileIndex}] to ${unrestrictedLink}`);
return unrestrictedLink;
}
function getNestedFiles(folder) {
return folder.e.flatMap(entry => {
if (Array.isArray(entry.e)) {
return getNestedFiles(entry);
}
return [entry];
});
}
async function getDefaultOptions(ip) {
return { ip, base_agent: AGENT, timeout: 10000 };
}

View file

@ -12,7 +12,7 @@
"@keyv/mongo": "^3.1.0",
"@paradise-cloud/easy-debrid": "^3.0.0",
"@putdotio/api-client": "^8.42.0",
"all-debrid-api": "^1.3.2",
"all-debrid-api": "^1.3.3",
"axios": "^1.13.2",
"cacheable": "^1.8.10",
"cors": "^2.8.5",
@ -232,9 +232,9 @@
}
},
"node_modules/all-debrid-api": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/all-debrid-api/-/all-debrid-api-1.3.2.tgz",
"integrity": "sha512-CxTgU4eCKrfcf2mctWI0vGtpZ8Wfm+f9CYEwUbgfr+FVT3rPUiBOiKU/cDoPXHSEQO8qArP0KKdnpwSEvbYWqg==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/all-debrid-api/-/all-debrid-api-1.3.3.tgz",
"integrity": "sha512-s3F80Wgy/ipi7jNanewCKwaCD9Uae/At1GBlfQ36DT2Vvg3a7LqqOvzwRrk41lMnSAXZnduRUDqzy2GfiaacEQ==",
"license": "MIT",
"dependencies": {
"axios": "^1.13.2"

View file

@ -12,7 +12,7 @@
"@keyv/mongo": "^3.1.0",
"@paradise-cloud/easy-debrid": "^3.0.0",
"@putdotio/api-client": "^8.42.0",
"all-debrid-api": "^1.3.2",
"all-debrid-api": "^1.3.3",
"axios": "^1.13.2",
"cacheable": "^1.8.10",
"cors": "^2.8.5",