From b4195934c1fd5ff97acf07d7fbd82f52e272c520 Mon Sep 17 00:00:00 2001 From: Vitiko Date: Sun, 14 Jul 2024 19:07:19 -0400 Subject: [PATCH] HDBits provider: handle KeyError (common exception) --- custom_libs/subliminal_patch/providers/hdbits.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/hdbits.py b/custom_libs/subliminal_patch/providers/hdbits.py index 19196aecd..87fdfaa82 100644 --- a/custom_libs/subliminal_patch/providers/hdbits.py +++ b/custom_libs/subliminal_patch/providers/hdbits.py @@ -96,7 +96,12 @@ class HDBitsProvider(Provider): "https://hdbits.org/api/torrents", json={**self._def_params, **lookup} ) response.raise_for_status() - ids = [item["id"] for item in response.json()["data"]] + + try: + ids = [item["id"] for item in response.json()["data"]] + except KeyError: + logger.debug("No data found") + return [] subtitles = [] for torrent_id in ids: