def get(self, options): match = re.search(r'data-videoid="([^"]+)"', self.get_urldata()) if not match: parse = urlparse(self.url) match = re.search(r'video/(\d+)/', parse.fragment) if not match: log.error("Can't find video id") sys.exit(2) videoid = match.group(1) data = get_http_data("http://svp.vg.no/svp/api/v1/vgtv/assets/%s?appName=vgtv-website" % videoid) jsondata = json.loads(data) if options.output_auto: directory = os.path.dirname(options.output) title = "%s" % jsondata["title"] title = filenamify(title) if len(directory): options.output = "%s/%s" % (directory, title) else: options.output = title if "hds" in jsondata["streamUrls"]: 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) 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()): yield HLS(copy.copy(options), streams[n], n) if "mp4" in jsondata["streamUrls"]: yield HTTP(copy.copy(options), jsondata["streamUrls"]["mp4"])
def test_sort(self): data = [ DASH(setup_defaults(), "http://example.com", 3000, None), HLS(setup_defaults(), "http://example.com", 2000, None), HTTP(setup_defaults(), "http://example.com", 3001, None), ] assert all([ a[0] == b.bitrate for a, b in zip( sort_quality(data), [ HTTP(setup_defaults(), "http://example.com", 3001, None), DASH(setup_defaults(), "http://example.com", 3000, None), HLS(setup_defaults(), "http://example.com", 2000, None), ], ) ])
def get(self, options): match = re.search("xmlUrl=([^ ]+)\" ", self.get_urldata()) if match: xmlurl = unquote_plus(match.group(1)) else: match = re.search(r"moviesList: \[\{\"VideoId\":\"(\d+)\"", self.get_urldata()) if not match: log.error("Can't find video id") sys.exit(2) vid = match.group(1) xmlurl = "http://www.expressen.se/Handlers/WebTvHandler.ashx?id=%s" % vid data = get_http_data(xmlurl) xml = ET.XML(data) live = xml.find("live").text if live != "0": options.live = True ss = xml.find("vurls") if is_py2_old: sa = list(ss.getiterator("vurl")) else: sa = list(ss.iter("vurl")) for i in sa: options2 = copy.copy(options) match = re.search(r"rtmp://([-0-9a-z\.]+/[-a-z0-9]+/)(.*)", i.text) filename = "rtmp://%s" % match.group(1) options2.other = "-y %s" % match.group(2) yield RTMP(options2, filename, int(i.attrib["bitrate"])) ipadurl = xml.find("mobileurls").find("ipadurl").text streams = hlsparse(ipadurl) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def get(self): data = self.get_urldata() if self.exclude(): yield ServiceError("Excluding video") return match = re.search(r'"([^"]+geo.php)"', data) if match: data = self.http.request("get", match.group(1)).content match = re.search(r'punktur=\(([^ ]+)\)', data) if match: janson = json.loads(match.group(1)) self.options.live = checklive(janson["result"][1]) streams = hlsparse( self.options, self.http.request("get", janson["result"][1]), janson["result"][1]) for n in list(streams.keys()): yield streams[n] else: yield ServiceError("Can't find json info") else: match = re.search(r'<source [^ ]*[ ]*src="([^"]+)" ', self.get_urldata()) if not match: yield ServiceError("Can't find video info for: %s" % self.url) return if match.group(1).endswith("mp4"): yield HTTP(copy.copy(self.options), match.group(1), 800) else: m3u8_url = match.group(1) self.options.live = checklive(m3u8_url) yield HLS(copy.copy(self.options), m3u8_url, 800)
def get(self, options): parse = urlparse(self.url) if parse.hostname == "video.disney.se": match = re.search(r"Grill.burger=({.*}):", self.get_urldata()) if not match: log.error("Can't find video info") return jsondata = json.loads(match.group(1)) for n in jsondata["stack"]: if len(n["data"]) > 0: for x in n["data"]: if "flavors" in x: for i in x["flavors"]: if i["format"] == "mp4": yield HTTP(copy.copy(options), i["url"], i["bitrate"]) else: match = re.search(r"uniqueId : '([^']+)'", self.get_urldata()) if not match: log.error("Can't find video info") return uniq = match.group(1) match = re.search("entryId : '([^']+)'", self.get_urldata()) entryid = match.group(1) match = re.search("partnerId : '([^']+)'", self.get_urldata()) partnerid = match.group(1) match = re.search("uiConfId : '([^']+)'", self.get_urldata()) uiconfid = match.group(1) url = "http://cdnapi.kaltura.com/html5/html5lib/v1.9.7.6/mwEmbedFrame.php?&wid=%s&uiconf_id=%s&entry_id=%s&playerId=%s&forceMobileHTML5=true&urid=1.9.7.6&callback=mwi" % \ (partnerid, uiconfid, entryid, uniq) data = get_http_data(url) match = re.search(r"mwi\(({.*})\);", data) jsondata = json.loads(match.group(1)) data = jsondata["content"] match = re.search(r"window.kalturaIframePackageData = ({.*});", data) jsondata = json.loads(match.group(1)) ks = jsondata["enviornmentConfig"]["ks"] if options.output_auto: name = jsondata["entryResult"]["meta"]["name"] directory = os.path.dirname(options.output) options.service = "disney" title = "%s-%s" % (name, options.service) title = filenamify(title) if len(directory): options.output = "%s/%s" % (directory, title) else: options.output = title url = "http://cdnapi.kaltura.com/p/%s/sp/%s00/playManifest/entryId/%s/format/applehttp/protocol/http/a.m3u8?ks=%s&referrer=aHR0cDovL3d3dy5kaXNuZXkuc2U=&" % ( partnerid[1:], partnerid[1:], entryid, ks) redirect = check_redirect(url) streams = hlsparse(redirect) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def get(self, options): match = re.search(r'"([^"]+geo.php)"', self.get_urldata()) if match: data = get_http_data(match.group(1)) match = re.search(r'punktur=\(([^ ]+)\)', data) if match: janson = json.loads(match.group(1)) options.live = checklive(janson["result"][1]) streams = hlsparse(janson["result"][1]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) else: match = re.search(r'<source [^ ]*[ ]*src="([^"]+)" ', self.get_urldata()) if not match: log.error("Can't find video info") sys.exit(2) m3u8_url = match.group(1) options.live = checklive(m3u8_url) yield HLS(copy.copy(options), m3u8_url, 800)
def get(self, options): vid = self._get_video_id() if vid is None: log.error("Cant find video file") sys.exit(2) url = "http://playapi.mtgx.tv/v3/videos/%s" % vid options.other = "" data = get_http_data(url) dataj = json.loads(data) if "msg" in dataj: log.error("%s" % dataj["msg"]) return if dataj["type"] == "live": options.live = True if dataj["sami_path"]: yield subtitle_sami(dataj["sami_path"]) streams = get_http_data("http://playapi.mtgx.tv/v3/videos/stream/%s" % vid) streamj = json.loads(streams) if "msg" in streamj: log.error( "Can't play this because the video is either not found or geoblocked." ) return if streamj["streams"]["medium"]: filename = streamj["streams"]["medium"] if filename[len(filename) - 3:] == "f4m": manifest = "%s?hdcore=2.8.0&g=hejsan" % filename streams = hdsparse(copy.copy(options), manifest) if streams: for n in list(streams.keys()): yield streams[n] else: parse = urlparse(filename) match = re.search("^(/[^/]+)/(.*)", parse.path) if not match: log.error("Somthing wrong with rtmpparse") sys.exit(2) filename = "%s://%s:%s%s" % (parse.scheme, parse.hostname, parse.port, match.group(1)) path = "-y %s" % match.group(2) options.other = "-W http://flvplayer.viastream.viasat.tv/flvplayer/play/swf/player.swf %s" % path yield RTMP(copy.copy(options), filename, 800) if streamj["streams"]["hls"]: streams = hlsparse(streamj["streams"]["hls"]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def get(self, options): match = re.search(r"urPlayer.init\((.*)\);", self.get_urldata()) if not match: log.error("Can't find json info") sys.exit(2) data = match.group(1) jsondata = json.loads(data) yield subtitle_tt(jsondata["subtitles"].split(",")[0]) basedomain = jsondata["streaming_config"]["streamer"]["redirect"] http = "http://%s/%s" % (basedomain, jsondata["file_html5"]) hd = None if len(jsondata["file_html5_hd"]) > 0: http_hd = "http://%s/%s" % (basedomain, jsondata["file_html5_hd"]) hls_hd = "%s%s" % (http_hd, jsondata["streaming_config"] ["http_streaming"]["hls_file"]) tmp = jsondata["file_html5_hd"] match = re.search(".*(mp[34]:.*$)", tmp) path_hd = match.group(1) hd = True hls = "%s%s" % ( http, jsondata["streaming_config"]["http_streaming"]["hls_file"]) rtmp = "rtmp://%s/%s" % ( basedomain, jsondata["streaming_config"]["rtmp"]["application"]) path = "mp%s:%s" % (jsondata["file_flash"][-1], jsondata["file_flash"]) streams = hlsparse(hls) for n in list(streams.keys()): yield HLS(options, streams[n], n) options.other = "-v -a %s -y %s" % ( jsondata["streaming_config"]["rtmp"]["application"], path) yield RTMP(options, rtmp, "480") if hd: streams = hlsparse(hls_hd) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) options.other = "-v -a %s -y %s" % ( jsondata["streaming_config"]["rtmp"]["application"], path_hd) yield RTMP(copy.copy(options), rtmp, "720")
def get(self, options): match = re.search(r'id="(bcPl[^"]+)"', self.get_urldata()) if not match: log.error("Can't find flash id.") sys.exit(2) flashid = match.group(1) match = re.search(r'playerID" value="([^"]+)"', self.get_urldata()) if not match: log.error("Can't find playerID") sys.exit(2) playerid = match.group(1) match = re.search(r'playerKey" value="([^"]+)"', self.get_urldata()) if not match: log.error("Can't find playerKey") sys.exit(2) playerkey = match.group(1) match = re.search(r'videoPlayer" value="([^"]+)"', self.get_urldata()) if not match: log.error("Can't find videoPlayer info") sys.exit(2) videoplayer = match.group(1) dataurl = "http://c.brightcove.com/services/viewer/htmlFederated?flashID=%s&playerID=%s&playerKey=%s&isVid=true&isUI=true&dynamicStreaming=true&@videoPlayer=%s" % ( flashid, playerid, playerkey, videoplayer) data = get_http_data(dataurl) match = re.search(r'experienceJSON = ({.*});', data) if not match: log.error("Can't find json data") sys.exit(2) jsondata = json.loads(match.group(1)) renditions = jsondata["data"]["programmedContent"]["videoPlayer"][ "mediaDTO"]["renditions"] for i in renditions: if i["defaultURL"].endswith("f4m"): manifest = "%s?hdcore=3.3.0" % i["defaultURL"] streams = hdsparse(copy.copy(options), manifest) if streams: for n in list(streams.keys()): yield streams[n] if i["defaultURL"].endswith("m3u8"): streams = hlsparse(i["defaultURL"]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def _get_channel(self, urlp, options): match = re.match(r'/(\w+)', urlp.path) if not match: raise JustinUrlException('channel', urlp.geturl()) channel = match.group(1) hls_url = self._get_hls_url(channel) urlp = urlparse(hls_url) options.live = True if not options.output: options.output = channel streams = hlsparse(hls_url) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def find_stream(options, resource): tempresource = resource['Data'][0]['Assets'] # To find the VideoResource, they have Images as well for resources in tempresource: if resources['Kind'] == 'VideoResource': links = resources['Links'] break for i in links: if i["Target"] == "Ios" or i["Target"] == "HLS": streams = hlsparse(i["Uri"]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) else: if i["Target"] == "Streaming": options.other = "-y '%s'" % i["Uri"].replace( "rtmp://vod.dr.dk/cms/", "") rtmp = "rtmp://vod.dr.dk/cms/" yield RTMP(copy.copy(options), rtmp, i["Bitrate"])
def get(self, options): data = self.get_urldata() match = re.search('data-aptomaId="([-0-9a-z]+)"', data) if not match: log.error("Can't find video info") sys.exit(2) videoId = match.group(1) match = re.search(r'data-isLive="(\w+)"', data) if not match: log.error("Can't find live info") sys.exit(2) if match.group(1) == "true": options.live = True if not options.live: dataurl = "http://aftonbladet-play-metadata.cdn.drvideo.aptoma.no/video/%s.json" % videoId data = get_http_data(dataurl) data = json.loads(data) videoId = data["videoId"] streamsurl = "http://aftonbladet-play-static-ext.cdn.drvideo.aptoma.no/actions/video/?id=%s&formats&callback=" % videoId streams = json.loads(get_http_data(streamsurl)) hlsstreams = streams["formats"]["hls"] if "level3" in hlsstreams.keys(): hls = hlsstreams["level3"] else: hls = hlsstreams["akamai"] if "csmil" in hls.keys(): hls = hls["csmil"][0] else: hls = hls["m3u8"][0] address = hls["address"] path = hls["path"] for i in hls["files"]: if "filename" in i.keys(): plist = "http://%s/%s/%s/master.m3u8" % (address, path, i["filename"]) else: plist = "http://%s/%s/%s" % (address, path, hls["filename"]) streams = hlsparse(plist) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def get(self, options): data = self.get_urldata() match = re.search("data-subtitlesurl = \"(/.*)\"", data) if match: parse = urlparse(self.url) subtitle = "%s://%s%s" % (parse.scheme, parse.netloc, match.group(1)) yield subtitle_tt(subtitle) if options.force_subtitle: return match = re.search(r'data-media="(.*manifest.f4m)"', data) if match: manifest_url = match.group(1) else: match = re.search(r'data-video-id="(\d+)"', data) if match is None: log.error("Can't find video id.") sys.exit(2) vid = match.group(1) match = re.search(r"PS_VIDEO_API_URL : '([^']*)',", data) if match is None: log.error("Can't find server address with media info") sys.exit(2) dataurl = "%smediaelement/%s" % (match.group(1), vid) data = json.loads(get_http_data(dataurl)) manifest_url = data["mediaUrl"] options.live = data["isLive"] hlsurl = manifest_url.replace("/z/", "/i/").replace("manifest.f4m", "master.m3u8") streams = hlsparse(hlsurl) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url streams = hdsparse(copy.copy(options), manifest_url) if streams: for n in list(streams.keys()): yield streams[n]
def get(self, options): data = self.get_urldata() parse = urlparse(self.url) vidoid = parse.path[parse.path.rfind("/") + 1:] match = re.search(r'JSONdata = ({.*});', data) if not match: log.error("Cant find json data") sys.exit(2) janson = json.loads(match.group(1)) playlist = janson["playlist"] for i in playlist: if i["brightcoveId"] == vidoid: if i["HLSURL"]: streams = hlsparse(i["HLSURL"]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) for n in i["renditions"]: if n["container"] == "MP4": yield HTTP(copy.copy(options), n["URL"], int(n["rate"]) / 1000)
def get(self, options): data = self.get_urldata() match = re.search(r'resource:[ ]*"([^"]*)",', data) if match: resource_url = match.group(1) resource_data = get_http_data(resource_url) resource = json.loads(resource_data) streams = find_stream(options, resource) for i in streams: yield i else: match = re.search(r'resource="([^"]*)"', data) if not match: log.error("Cant find resource info for this video") sys.exit(2) resource_url = "%s" % match.group(1) resource_data = get_http_data(resource_url) resource = json.loads(resource_data) if "Data" in resource: streams = find_stream(options, resource) for i in streams: yield i else: for stream in resource['Links']: if stream["Target"] == "HDS": manifest = "%s?hdcore=2.8.0&g=hejsan" % stream["Uri"] streams = hdsparse(copy.copy(options), manifest) 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()): yield HLS(copy.copy(options), streams[n], n) if stream["Target"] == "Streaming": options.other = "-v -y '%s'" % stream['Uri'].replace( "rtmp://vod.dr.dk/cms/", "") rtmp = "rtmp://vod.dr.dk/cms/" yield RTMP(copy.copy(options), rtmp, stream['Bitrate'])
def get(self): data = self.get_urldata() match = re.search(r'"([^"]+geo.php)"', data) if match: data = self.http.request("get", match.group(1)).content match = re.search(r"punktur=\(([^ ]+)\)", data) if match: janson = json.loads(match.group(1)) self.config.get("live", checklive(janson["result"][1])) streams = hlsparse(self.config, self.http.request("get", janson["result"][1]), janson["result"][1], output=self.output) for n in list(streams.keys()): yield streams[n] else: yield ServiceError("Can't find json info") else: match = re.search(r'<source [^ ]*[ ]*src="([^"]+)" ', self.get_urldata()) if not match: yield ServiceError("Can't find video info for: %s" % self.url) return if match.group(1).endswith("mp4"): yield HTTP(copy.copy(self.config), match.group(1), 800, output=self.output) else: m3u8_url = match.group(1) self.config.set("live", checklive(m3u8_url)) yield HLS(copy.copy(self.config), m3u8_url, 800, output=self.output)
def get(self, options): if re.findall("svt.se", self.url): match = re.search(r"data-json-href=\"(.*)\"", self.get_urldata()) if match: filename = match.group(1).replace("&", "&").replace( "&format=json", "") url = "http://www.svt.se%s" % filename else: log.error("Can't find video file") sys.exit(2) else: url = self.url pos = url.find("?") if pos < 0: dataurl = "%s?&output=json&format=json" % url else: dataurl = "%s&output=json&format=json" % url data = json.loads(get_http_data(dataurl)) if "live" in data["video"]: options.live = data["video"]["live"] else: options.live = False if data["video"]["subtitleReferences"]: subtitle = None try: subtitle = data["video"]["subtitleReferences"][0]["url"] except KeyError: pass if subtitle and len(subtitle) > 0: yield subtitle_wsrt(subtitle) if options.output_auto: directory = os.path.dirname(options.output) options.service = "svtplay" name = data["statistics"]["folderStructure"] if name.find(".") > 0: title = "%s-%s-%s-%s" % (name[:name.find(".")], data["statistics"]["title"], data["videoId"], options.service) else: title = "%s-%s-%s-%s" % (name, data["statistics"]["title"], data["videoId"], options.service) title = filenamify(title) if len(directory): options.output = "%s/%s" % (directory, title) else: options.output = title if options.force_subtitle: return for i in data["video"]["videoReferences"]: parse = urlparse(i["url"]) if parse.path.find("m3u8") > 0: streams = hlsparse(i["url"]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) elif parse.path.find("f4m") > 0: match = re.search(r"\/se\/secure\/", i["url"]) if not match: 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) 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) match = re.search( r"value=\"(/(public)?(statiskt)?/swf(/video)?/svtplayer-[0-9\.a-f]+swf)\"", data) swf = "http://www.svtplay.se%s" % match.group(1) options.other = "-W %s" % swf yield RTMP(copy.copy(options), i["url"], i["bitrate"]) else: yield HTTP(copy.copy(options), i["url"], "0")
def get(self, options): parse = urlparse(self.url) if "tv4play.se" in self.url: try: vid = parse_qs(parse.query)["video_id"][0] except KeyError: log.error("Can't find video file") sys.exit(2) else: match = re.search(r"\"vid\":\"(\d+)\",", self.get_urldata()) if match: vid = match.group(1) else: match = re.search(r"-(\d+)$", self.url) if match: vid = match.group(1) else: log.error("Can't find video id") sys.exit(2) url = "http://premium.tv4play.se/api/web/asset/%s/play" % vid data = get_http_data(url) xml = ET.XML(data) ss = xml.find("items") if is_py2_old: sa = list(ss.getiterator("item")) else: sa = list(ss.iter("item")) if xml.find("live").text: if xml.find("live").text != "false": options.live = True if xml.find("drmProtected").text == "true": log.error("DRM protected content.") sys.exit(2) if options.output_auto: directory = os.path.dirname(options.output) options.service = "tv4play" title = "%s-%s-%s" % (options.output, vid, options.service) title = filenamify(title) if len(directory): options.output = "%s/%s" % (directory, title) else: options.output = title for i in sa: if i.find("mediaFormat").text == "mp4": base = urlparse(i.find("base").text) parse = urlparse(i.find("url").text) if base.scheme == "rtmp": swf = "http://www.tv4play.se/flash/tv4playflashlets.swf" options.other = "-W %s -y %s" % (swf, i.find("url").text) yield RTMP(copy.copy(options), i.find("base").text, i.find("bitrate").text) elif parse.path[len(parse.path)-3:len(parse.path)] == "f4m": query = "" if i.find("url").text[-1] != "?": query = "?" manifest = "%s%shdcore=2.8.0&g=hejsan" % (i.find("url").text, query) streams = hdsparse(copy.copy(options), manifest) if streams: for n in list(streams.keys()): yield streams[n] elif i.find("mediaFormat").text == "smi": yield subtitle_smi(i.find("url").text) url = "http://premium.tv4play.se/api/web/asset/%s/play?protocol=hls" % vid data = get_http_data(url) xml = ET.XML(data) ss = xml.find("items") if is_py2_old: sa = list(ss.getiterator("item")) else: sa = list(ss.iter("item")) for i in sa: if i.find("mediaFormat").text == "mp4": parse = urlparse(i.find("url").text) if parse.path.endswith("m3u8"): streams = hlsparse(i.find("url").text) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n)
def get(self, options): match = re.search(r".*video/([0-9]+)", self.url) if not match: log.error("Can't find video file") return video_id = match.group(1) if options.username and options.password: # get session cookie data = get_http_data("http://www.kanal5play.se/", cookiejar=self.cj) authurl = "https://kanal5swe.appspot.com/api/user/login?callback=jQuery171029989&email=%s&password=%s&_=136250" % \ (options.username, options.password) data = get_http_data(authurl) match = re.search(r"({.*})\);", data) jsondata = json.loads(match.group(1)) if jsondata["success"] is False: log.error(jsondata["message"]) return authToken = jsondata["userData"]["auth"] cc = Cookie(version=0, name='authToken', value=authToken, port=None, port_specified=False, domain='www.kanal5play.se', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}) self.cj.set_cookie(cc) url = "http://www.kanal5play.se/api/getVideo?format=FLASH&videoId=%s" % video_id data = json.loads(get_http_data(url, cookiejar=self.cj)) options.cookiejar = self.cj if not options.live: options.live = data["isLive"] if data["hasSubtitle"]: yield subtitle_json("http://www.kanal5play.se/api/subtitles/%s" % video_id) if options.output_auto: directory = os.path.dirname(options.output) options.service = "kanal5" title = "%s-s%s-%s-%s-%s" % (data["program"]["name"], data["seasonNumber"], data["episodeText"], data["id"], options.service) title = filenamify(title) if len(directory): options.output = "%s/%s" % (directory, title) else: options.output = title if options.force_subtitle: return if "streams" in data: for i in data["streams"]: if i["drmProtected"]: log.error("We cant download drm files for this site.") return steambaseurl = data["streamBaseUrl"] bitrate = i["bitrate"] if bitrate > 1000: bitrate = bitrate / 1000 options2 = copy.copy(options) options2.other = "-W %s -y %s " % ("http://www.kanal5play.se/flash/K5StandardPlayer.swf", i["source"]) options2.live = True yield RTMP(options2, steambaseurl, bitrate) url = "http://www.kanal5play.se/api/getVideo?format=IPAD&videoId=%s" % video_id data = json.loads(get_http_data(url, cookiejar=self.cj)) if "streams" in data.keys(): for i in data["streams"]: streams = hlsparse(i["source"]) for n in list(streams.keys()): yield HLS(copy.copy(options), streams[n], n) if "reasonsForNoStreams" in data: log.error(data["reasonsForNoStreams"][0])