mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] uses forked rd library
This commit is contained in:
@@ -6,7 +6,11 @@ const RESOLVER_HOST = process.env.RESOLVER_HOST || 'http://localhost:7000';
|
||||
async function applyMoch(streams, apiKey) {
|
||||
const RD = new RealDebridClient(apiKey);
|
||||
const hashes = streams.map(stream => stream.infoHash);
|
||||
const available = await _instantAvailability(RD, hashes);
|
||||
const available = await RD.torrents.instantAvailability(hashes)
|
||||
.catch(error => {
|
||||
console.warn('Failed cached torrent availability request: ', error);
|
||||
return undefined;
|
||||
});
|
||||
if (available) {
|
||||
streams.forEach(stream => {
|
||||
const cachedEntry = available[stream.infoHash];
|
||||
@@ -23,14 +27,6 @@ async function applyMoch(streams, apiKey) {
|
||||
return streams;
|
||||
}
|
||||
|
||||
async function _instantAvailability(RD, hashes) {
|
||||
return RD._get(`torrents/instantAvailability/${hashes.join('/')}`)
|
||||
.catch(error => {
|
||||
console.warn('Failed cached torrent availability request: ', error);
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
function getCachedFileIds(fileIndex, hosterResults) {
|
||||
if (!hosterResults || Array.isArray(hosterResults)) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user