mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
return only streams property for moch meta
This commit is contained in:
@@ -67,7 +67,7 @@ async function getItemMeta(itemId, apiKey) {
|
||||
id: `${KEY}:${torrent.id}:${index}`,
|
||||
title: file.filename,
|
||||
released: new Date(torrent.uploadDate * 1000 - index).toISOString(),
|
||||
stream: { url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }
|
||||
streams: [{ url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }]
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ async function getItemMeta(itemId, apiKey, ip) {
|
||||
id: `${KEY}:${torrent.id}:${index}`,
|
||||
title: file.name,
|
||||
released: new Date(torrent.created * 1000 - index).toISOString(),
|
||||
stream: { url: file.downloadUrl }
|
||||
streams: [{ url: file.downloadUrl }]
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -118,12 +118,11 @@ async function getMochItemMeta(mochKey, itemId, config) {
|
||||
|
||||
return moch.instance.getItemMeta(itemId, config[moch.key], config.ip)
|
||||
.then(meta => {
|
||||
meta.videos.forEach(video => {
|
||||
if (!video.stream.url.startsWith('http')) {
|
||||
video.stream.url = `${RESOLVER_HOST}/${moch.key}/${video.stream.url}`
|
||||
}
|
||||
video.streams = [video.stream];
|
||||
});
|
||||
meta.videos
|
||||
.map(video => video.streams)
|
||||
.reduce((a, b) => a.concat(b), [])
|
||||
.filter(stream => !stream.url.startsWith('http'))
|
||||
.forEach(stream => stream.url = `${RESOLVER_HOST}/${moch.key}/${stream.url}`)
|
||||
return meta;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ async function getItemMeta(itemId, apiKey, ip) {
|
||||
id: `${KEY}:${file.id}:${index}`,
|
||||
title: file.name,
|
||||
released: new Date(file.created_at * 1000 - index).toISOString(),
|
||||
stream: { url: file.link || file.stream_link }
|
||||
streams: [{ url: file.link || file.stream_link }]
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ async function getItemMeta(itemId, apiKey, ip) {
|
||||
id: `${KEY}:${torrent.id}:${file.id}`,
|
||||
title: file.path,
|
||||
released: new Date(new Date(torrent.added).getTime() - index).toISOString(),
|
||||
stream: { url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }
|
||||
streams: [{ url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }]
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user