From 95db3b4e99bbf56aed1e9fd8b968de34ac51fbcf Mon Sep 17 00:00:00 2001 From: Rongrong <15956627+Rongronggg9@users.noreply.github.com> Date: Tue, 29 Mar 2022 21:12:16 +0800 Subject: [PATCH] fix(core): torrent searching error (#9407) Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com> --- lib/utils/torrent.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/utils/torrent.js b/lib/utils/torrent.js index a57562d6d..099ebaa45 100644 --- a/lib/utils/torrent.js +++ b/lib/utils/torrent.js @@ -60,6 +60,7 @@ class HDHome extends TorrentProvider { ); } } + TorrentSearchApi.loadProvider(HDHome); const allProviders = ['HDHome', 'Rarbg', '1337x', 'Yts', 'Eztv']; @@ -119,7 +120,14 @@ module.exports = { const keyword = keywords[0]; const normalizeKeyword = normalize(keyword); - const torrents = await TorrentSearchApi.search(providers, keywords.join(' '), category); + let torrents; + try { + torrents = await TorrentSearchApi.search(providers, keywords.join(' '), category); + } catch (e) { + // expect a status code error, but we don't mind catching all errors here + // logger.debug(e); + return {}; + } if (torrents && torrents.length > 0) { let bestRating = 0; let bestSize = 0;