mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 12:15:40 +01:00
Add try/except for json parsing in Aftonbladet service
This commit is contained in:
parent
78d1ad6934
commit
67421bc6fb
@ -58,13 +58,18 @@ class Aftonbladet(Service):
|
|||||||
yield ServiceError("Can't find video info")
|
yield ServiceError("Can't find video info")
|
||||||
return
|
return
|
||||||
|
|
||||||
videos = self._get_video(match.group(1))
|
try:
|
||||||
|
janson = json.loads(match.group(1))
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
yield ServiceError("Can't decode api request: {0}".format(match.group(1)))
|
||||||
|
return
|
||||||
|
|
||||||
|
videos = self._get_video(janson)
|
||||||
for i in videos:
|
for i in videos:
|
||||||
yield i
|
yield i
|
||||||
|
|
||||||
def _get_video(self, url):
|
def _get_video(self, janson):
|
||||||
|
|
||||||
janson = json.loads(url)
|
|
||||||
articleid = janson["article"]["currentArticleId"]
|
articleid = janson["article"]["currentArticleId"]
|
||||||
components = janson["articles"][articleid]["article"]["components"]
|
components = janson["articles"][articleid]["article"]["components"]
|
||||||
for i in components:
|
for i in components:
|
||||||
|
Loading…
Reference in New Issue
Block a user