diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-07-05 15:06:04 +0200 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-07-05 15:06:04 +0200 |
commit | 1c3db3ea3c8d843f178fa6a5400705e6fe29b925 (patch) | |
tree | f2c4ed989eeb0223547a42695d8fa29fd46298e4 /src/livestreamer/plugins/svtplay.py | |
parent | 6db1dc81c2bf5efab4329c17a09f9ee1985cdc5e (diff) |
Smoother JSON checks.
Diffstat (limited to 'src/livestreamer/plugins/svtplay.py')
-rw-r--r-- | src/livestreamer/plugins/svtplay.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/livestreamer/plugins/svtplay.py b/src/livestreamer/plugins/svtplay.py index 5757ac1..62c7555 100644 --- a/src/livestreamer/plugins/svtplay.py +++ b/src/livestreamer/plugins/svtplay.py @@ -3,7 +3,7 @@ from livestreamer.compat import str from livestreamer.plugins import Plugin, PluginError, NoStreamsError, register_plugin from livestreamer.stream import RTMPStream -from livestreamer.utils import urlget, swfverify +from livestreamer.utils import urlget, swfverify, verifyjson import json, re @@ -37,11 +37,9 @@ class SVTPlay(Plugin): except ValueError as err: raise PluginError(("Unable to parse JSON: {0})").format(err)) - if not ("video" in info and "videoReferences" in info["video"]): - raise PluginError("Missing 'video' or 'videoReferences' key in JSON") - streams = {} - videos = info["video"]["videoReferences"] + video = verifyjson(info, "video") + videos = verifyjson(video, "videoReferences") swfhash, swfsize = swfverify(self.SWFURL) for video in videos: |