From 20187a1145f870874fd2a8bd94f3ddb3761ae82e Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Mon, 29 Apr 2024 09:09:17 +0300 Subject: [PATCH] fix failing rd retry when infohash not indexed --- addon/lib/magnetHelper.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addon/lib/magnetHelper.js b/addon/lib/magnetHelper.js index 8ce6063..2705936 100644 --- a/addon/lib/magnetHelper.js +++ b/addon/lib/magnetHelper.js @@ -62,11 +62,11 @@ let ALL_RUSSIAN_TRACKERS = []; export async function getMagnetLink(infoHash) { const torrent = await getTorrent(infoHash).catch(() => ({ infoHash })); const torrentTrackers = torrent?.trackers?.split(',') || []; - const animeTrackers = torrent.type === Type.ANIME ? ALL_ANIME_TRACKERS : []; - const providerTrackers = RUSSIAN_PROVIDERS.includes(torrent.provider) && ALL_RUSSIAN_TRACKERS || []; + const animeTrackers = torrent?.type === Type.ANIME ? ALL_ANIME_TRACKERS : []; + const providerTrackers = RUSSIAN_PROVIDERS.includes(torrent?.provider) && ALL_RUSSIAN_TRACKERS || []; const trackers = unique([].concat(torrentTrackers).concat(animeTrackers).concat(providerTrackers)); - return magnet.encode({ infoHash: infoHash, name: torrent.title, announce: trackers }); + return magnet.encode({ infoHash: infoHash, name: torrent?.title, announce: trackers }); } export async function initBestTrackers() { @@ -112,4 +112,4 @@ export function enrichStreamSources(stream) { function unique(array) { return Array.from(new Set(array)); -} \ No newline at end of file +}