mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-22 05:51:10 +00:00
Fix argenteam TypeError and JSONDecodeError
This commit is contained in:
parent
d20fa5d3d0
commit
38d2332c39
1 changed files with 16 additions and 4 deletions
|
@ -1,11 +1,14 @@
|
|||
# coding=utf-8
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
import os
|
||||
import io
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
from json.decoder import JSONDecodeError
|
||||
|
||||
from zipfile import ZipFile
|
||||
from guessit import guessit
|
||||
from requests import Session
|
||||
|
@ -91,7 +94,14 @@ class ArgenteamProvider(Provider, ProviderSubtitleArchiveMixin):
|
|||
r = self.session.get(API_URL + "search", params={"q": query}, timeout=10)
|
||||
r.raise_for_status()
|
||||
|
||||
results = r.json()
|
||||
try:
|
||||
results = r.json()
|
||||
except JSONDecodeError:
|
||||
return []
|
||||
|
||||
if not results.get("results"):
|
||||
return []
|
||||
|
||||
match_ids = []
|
||||
for result in results["results"]:
|
||||
if result["type"] == "movie" and is_episode:
|
||||
|
@ -194,11 +204,13 @@ class ArgenteamProvider(Provider, ProviderSubtitleArchiveMixin):
|
|||
for aid in argenteam_ids:
|
||||
response = self.session.get(url, params={"id": aid}, timeout=10)
|
||||
response.raise_for_status()
|
||||
content = response.json()
|
||||
if not content:
|
||||
|
||||
try:
|
||||
content = response.json()
|
||||
except JSONDecodeError:
|
||||
continue
|
||||
|
||||
if not content.get("releases"):
|
||||
if not content or not content.get("releases"):
|
||||
continue
|
||||
|
||||
imdb_id = year = None
|
||||
|
|
Loading…
Reference in a new issue