Fix argenteam TypeError and JSONDecodeError

pull/1451/head
vitiko98 4 years ago
parent d20fa5d3d0
commit 38d2332c39

@ -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()
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()
try:
content = response.json()
if not content:
except JSONDecodeError:
continue
if not content.get("releases"):
if not content or not content.get("releases"):
continue
imdb_id = year = None

Loading…
Cancel
Save