summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorVitiko <[email protected]>2023-10-10 03:13:55 -0400
committerVitiko <[email protected]>2023-10-10 03:13:55 -0400
commit0031abcea4b7a054e55d96005ec9d0eb76490691 (patch)
tree9aaade4329899c3783c47d5b8a782a19b150ba23 /libs
parentec8772c96bdb3cd918d9332ae9db5c974bd1e2a3 (diff)
downloadbazarr-0031abcea4b7a054e55d96005ec9d0eb76490691.tar.gz
bazarr-0031abcea4b7a054e55d96005ec9d0eb76490691.zip
HDBits provider: handle JSON errors
Diffstat (limited to 'libs')
-rw-r--r--libs/subliminal_patch/providers/hdbits.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/subliminal_patch/providers/hdbits.py b/libs/subliminal_patch/providers/hdbits.py
index 6396b6d15..09b2140a5 100644
--- a/libs/subliminal_patch/providers/hdbits.py
+++ b/libs/subliminal_patch/providers/hdbits.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import functools
+from json import JSONDecodeError
import logging
import time
@@ -108,7 +109,12 @@ class HDBitsProvider(Provider):
"https://hdbits.org/api/subtitles",
json={**self._def_params, **{"torrent_id": torrent_id}},
)
- subtitles = response.json()["data"]
+ try:
+ subtitles = response.json()["data"]
+ except JSONDecodeError:
+ logger.debug("Couldn't get reponse for %s", torrent_id)
+ return []
+
parsed_subs = []
for subtitle in subtitles:
if not subtitle["filename"].endswith(_ALLOWED_EXTENSIONS):