diff --git a/lib/svtplay_dl/fetcher/hds.py b/lib/svtplay_dl/fetcher/hds.py index fa59271..ad25114 100644 --- a/lib/svtplay_dl/fetcher/hds.py +++ b/lib/svtplay_dl/fetcher/hds.py @@ -52,6 +52,9 @@ def hdsparse(options, manifest): bootstrapIter = xml.iter("{http://ns.adobe.com/f4m/1.0}bootstrapInfo") mediaIter = xml.iter("{http://ns.adobe.com/f4m/1.0}media") + if xml.find("{http://ns.adobe.com/f4m/1.0}drmAdditionalHeader") is not None: + log.error("HDS DRM protected content.") + return for i in bootstrapIter: if "id" in i.attrib: bootstrap[i.attrib["id"]] = i.text diff --git a/lib/svtplay_dl/service/bigbrother.py b/lib/svtplay_dl/service/bigbrother.py index 6e5feae..128942d 100644 --- a/lib/svtplay_dl/service/bigbrother.py +++ b/lib/svtplay_dl/service/bigbrother.py @@ -52,8 +52,9 @@ class Bigbrother(Service): if i["defaultURL"].endswith("f4m"): manifest = "%s?hdcore=3.3.0" % i["defaultURL"] streams = hdsparse(copy.copy(options), manifest) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] if i["defaultURL"].endswith("m3u8"): streams = hlsparse(i["defaultURL"]) diff --git a/lib/svtplay_dl/service/dr.py b/lib/svtplay_dl/service/dr.py index 920bcaf..48fa2a7 100644 --- a/lib/svtplay_dl/service/dr.py +++ b/lib/svtplay_dl/service/dr.py @@ -44,8 +44,9 @@ class Dr(Service, OpenGraphThumbMixin): if stream["Target"] == "HDS": manifest = "%s?hdcore=2.8.0&g=hejsan" % stream["Uri"] streams = hdsparse(copy.copy(options), manifest) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] if stream["Target"] == "HLS": streams = hlsparse(stream["Uri"]) for n in list(streams.keys()): diff --git a/lib/svtplay_dl/service/nrk.py b/lib/svtplay_dl/service/nrk.py index b531f82..d288493 100644 --- a/lib/svtplay_dl/service/nrk.py +++ b/lib/svtplay_dl/service/nrk.py @@ -53,5 +53,6 @@ class Nrk(Service, OpenGraphThumbMixin): manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url streams = hdsparse(copy.copy(options), manifest_url) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index fd6200b..bd603ea 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -87,8 +87,9 @@ class Svtplay(Service, OpenGraphThumbMixin): parse = urlparse(i["url"]) manifest = "%s://%s%s?%s&hdcore=3.3.0" % (parse.scheme, parse.netloc, parse.path, parse.query) streams = hdsparse(copy.copy(options), manifest) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] elif parse.scheme == "rtmp": embedurl = "%s?type=embed" % url data = get_http_data(embedurl) diff --git a/lib/svtplay_dl/service/tv4play.py b/lib/svtplay_dl/service/tv4play.py index 8812920..347bbb3 100644 --- a/lib/svtplay_dl/service/tv4play.py +++ b/lib/svtplay_dl/service/tv4play.py @@ -84,8 +84,9 @@ class Tv4play(Service, OpenGraphThumbMixin): query = "?" manifest = "%s%shdcore=2.8.0&g=hejsan" % (i.find("url").text, query) streams = hdsparse(copy.copy(options), manifest) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] elif i.find("mediaFormat").text == "smi": yield subtitle_smi(i.find("url").text) diff --git a/lib/svtplay_dl/service/vg.py b/lib/svtplay_dl/service/vg.py index f518688..9d46109 100644 --- a/lib/svtplay_dl/service/vg.py +++ b/lib/svtplay_dl/service/vg.py @@ -40,8 +40,9 @@ class Vg(Service, OpenGraphThumbMixin): parse = urlparse(jsondata["streamUrls"]["hds"]) manifest = "%s://%s%s?%s&hdcore=3.3.0" % (parse.scheme, parse.netloc, parse.path, parse.query) streams = hdsparse(copy.copy(options), manifest) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] if "hls" in jsondata["streamUrls"]: streams = hlsparse(jsondata["streamUrls"]["hls"]) for n in list(streams.keys()): diff --git a/lib/svtplay_dl/service/viaplay.py b/lib/svtplay_dl/service/viaplay.py index b622573..5be2c4a 100644 --- a/lib/svtplay_dl/service/viaplay.py +++ b/lib/svtplay_dl/service/viaplay.py @@ -97,8 +97,9 @@ class Viaplay(Service, OpenGraphThumbMixin): if filename[len(filename)-3:] == "f4m": manifest = "%s?hdcore=2.8.0&g=hejsan" % filename streams = hdsparse(copy.copy(options), manifest) - for n in list(streams.keys()): - yield streams[n] + if streams: + for n in list(streams.keys()): + yield streams[n] else: parse = urlparse(filename) match = re.search("^(/[^/]+)/(.*)", parse.path)