mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
resolve offcloud url for single file torrents
This commit is contained in:
@@ -117,11 +117,17 @@ async function _findTorrent(OC, infoHash) {
|
|||||||
|
|
||||||
async function _createTorrent(OC, infoHash) {
|
async function _createTorrent(OC, infoHash) {
|
||||||
const magnetLink = await getMagnetLink(infoHash);
|
const magnetLink = await getMagnetLink(infoHash);
|
||||||
return await OC.cloud.download(magnetLink)
|
return OC.cloud.download(magnetLink)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _unrestrictLink(OC, infoHash, torrent, cachedEntryInfo, fileIndex) {
|
async function _unrestrictLink(OC, infoHash, torrent, cachedEntryInfo, fileIndex) {
|
||||||
const files = await OC.cloud.explore(torrent.requestId)
|
const files = await OC.cloud.explore(torrent.requestId)
|
||||||
|
.catch(error => {
|
||||||
|
if (error === 'Bad archive') {
|
||||||
|
return [`https://${torrent.server}.offcloud.com/cloud/download/${torrent.requestId}/${torrent.fileName}`];
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
})
|
||||||
const targetFile = Number.isInteger(fileIndex)
|
const targetFile = Number.isInteger(fileIndex)
|
||||||
? files.find(file => file.includes(`/${torrent.requestId}/${fileIndex}/`))
|
? files.find(file => file.includes(`/${torrent.requestId}/${fileIndex}/`))
|
||||||
: files.find(file => isVideo(file));
|
: files.find(file => isVideo(file));
|
||||||
|
|||||||
Reference in New Issue
Block a user