本文整理汇总了Python中svtplay_dl.fetcher.hls.hlsparse函数的典型用法代码示例。如果您正苦于以下问题:Python hlsparse函数的具体用法?Python hlsparse怎么用?Python hlsparse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hlsparse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get
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")
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:32,代码来源:urplay.py
示例2: _get_video
def _get_video(self, janson):
articleid = janson["article"]["currentArticleId"]
components = janson["articles"][articleid]["article"]["components"]
for i in components:
if "components" in i:
for n in i["components"]:
if "type" in n and n["type"] == "video":
streams = hlsparse(self.options, self.http.request("get", n["videoAsset"]["streamUrls"]["hls"]),
n["videoAsset"]["streamUrls"]["hls"])
if streams:
for key in list(streams.keys()):
yield streams[key]
if "videoAsset" in i and "streamUrls" in i["videoAsset"]:
streams = []
streamUrls = i["videoAsset"]["streamUrls"]
if "hls" in streamUrls:
streams.append(hlsparse(self.options, self.http.request("get", streamUrls["hls"]),
streamUrls["hls"]))
if "hds" in streamUrls:
streams.append(hdsparse(self.options, self.http.request("get", streamUrls["hds"],
params={"hdcore": "3.7.0"}),
streamUrls["hds"]))
if streams:
for s in streams:
for key in list(s.keys()):
yield s[key]
开发者ID:olof,项目名称:svtplay-dl,代码行数:32,代码来源:aftonbladet.py
示例3: get
def get(self):
data = self.get_urldata()
if self.exclude():
yield ServiceError("Excluding video")
return
match = re.search('="(https://www.expressen.se/tvspelare[^"]+)"', data)
if not match:
log.error("Can't find video id")
return
url = decode_html_entities(match.group(1))
data = self.http.request("get", url)
match = re.search("window.Player.settings = ({.*});", data.text)
if not match:
log.error("Can't find json info.")
dataj = json.loads(match.group(1))
if "streams" in dataj:
if "iPad" in dataj["streams"]:
streams = hlsparse(self.options, self.http.request("get", dataj["streams"]["iPad"]), dataj["streams"]["iPad"])
for n in list(streams.keys()):
yield streams[n]
if "hashHls" in dataj["streams"]:
streams = hlsparse(self.options, self.http.request("get", dataj["streams"]["hashHls"]), dataj["streams"]["hashHls"])
for n in list(streams.keys()):
yield streams[n]
开发者ID:magic75,项目名称:svtplay-dl,代码行数:28,代码来源:expressen.py
示例4: get
def get(self):
parse = urlparse(self.url)
if parse.path[:8] == "/kanaler":
end_time_stamp = (datetime.utcnow() - timedelta(minutes=1, seconds=20)).replace(microsecond=0)
start_time_stamp = end_time_stamp - timedelta(minutes=1)
url = "https://bbr-l2v.akamaized.net/live/{0}/master.m3u8?in={1}&out={2}?".format(parse.path[9:],
start_time_stamp.isoformat(),
end_time_stamp.isoformat())
self.config.set("live", True)
streams = hlsparse(self.config, self.http.request("get", url), url, output=self.output, hls_time_stamp=True)
for n in list(streams.keys()):
yield streams[n]
return
match = self._getjson()
if not match:
yield ServiceError("Can't find json data")
return
jansson = json.loads(match.group(1))
if "assetId" not in jansson["props"]["pageProps"]:
yield ServiceError("Cant find video id for the video")
return
vid = jansson["props"]["pageProps"]["assetId"]
janson2 = jansson["props"]["apolloState"]
item = janson2["VideoAsset:{}".format(vid)]
if item["is_drm_protected"]:
yield ServiceError("We can't download DRM protected content from this site.")
return
if item["live"]:
self.config.set("live", True)
if item["season"] > 0:
self.output["season"] = item["season"]
if item["episode"] > 0:
self.output["episode"] = item["episode"]
self.output["title"] = item["program_nid"]
self.output["episodename"] = item["title"]
self.output["id"] = str(vid)
if vid is None:
yield ServiceError("Cant find video id for the video")
return
url = "https://playback-api.b17g.net/media/{}?service=tv4&device=browser&protocol=hls%2Cdash&drm=widevine".format(vid)
res = self.http.request("get", url, cookies=self.cookies)
if res.status_code > 200:
yield ServiceError("Can't play this because the video is geoblocked or not available.")
return
if res.json()["playbackItem"]["type"] == "hls":
streams = hlsparse(self.config, self.http.request("get", res.json()["playbackItem"]["manifestUrl"]),
res.json()["playbackItem"]["manifestUrl"], output=self.output, httpobject=self.http)
for n in list(streams.keys()):
yield streams[n]
开发者ID:spaam,项目名称:svtplay-dl,代码行数:58,代码来源:tv4play.py
示例5: get
def get(self):
data = self.get_urldata()
match = re.search(r"urPlayer.init\((.*)\);", data)
if not match:
yield ServiceError("Can't find json info")
return
if self.exclude():
yield ServiceError("Excluding video")
return
data = match.group(1)
jsondata = json.loads(data)
if len(jsondata["subtitles"]) > 0:
for sub in jsondata["subtitles"]:
if "label" in sub:
absurl = urljoin(self.url, sub["file"].split(",")[0])
if absurl.endswith("vtt"):
subtype = "wrst"
else:
subtype = "tt"
if self.options.get_all_subtitles:
yield subtitle(copy.copy(self.options), subtype, absurl, "-" + filenamify(sub["label"]))
else:
yield subtitle(copy.copy(self.options), subtype, absurl)
if "streamer" in jsondata["streaming_config"]:
basedomain = jsondata["streaming_config"]["streamer"]["redirect"]
else:
url = jsondata["streaming_config"]["loadbalancer"]
if url[:1] == "/":
url = "https:{}".format(url)
lbjson = self.http.request("get", url).text
lbjson = json.loads(lbjson)
basedomain = lbjson["redirect"]
http = "https://{0}/{1}".format(basedomain, jsondata["file_http"])
hd = None
if len(jsondata["file_http_hd"]) > 0:
http_hd = "https://{0}/{1}".format(basedomain, jsondata["file_http_hd"])
hls_hd = "{0}{1}".format(http_hd, jsondata["streaming_config"]["http_streaming"]["hls_file"])
hd = True
hls = "{0}{1}".format(http, jsondata["streaming_config"]["http_streaming"]["hls_file"])
streams = hlsparse(self.options, self.http.request("get", hls), hls)
for n in list(streams.keys()):
yield streams[n]
if hd:
streams = hlsparse(self.options, self.http.request("get", hls_hd), hls_hd)
for n in list(streams.keys()):
yield streams[n]
开发者ID:olof,项目名称:svtplay-dl,代码行数:49,代码来源:urplay.py
示例6: get
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)
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":
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"])
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)
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)
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'])
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:48,代码来源:dr.py
示例7: get
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)
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)
for n in list(streams.keys()):
yield streams[n]
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:34,代码来源:nrk.py
示例8: get
def get(self, options):
data = self.get_urldata()
if self.exclude(options):
return
extention = False
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
if options.output and os.path.isdir(options.output):
options.output = os.path.join(os.path.dirname(options.output), filename)
extention = True
elif options.output is None:
options.output = "%s" % filename
extention = True
if self.url.find(".f4m") > 0:
if extention:
options.output = "%s.flv" % options.output
streams = hdsparse(options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url)
if streams:
for n in list(streams.keys()):
yield streams[n]
if self.url.find(".m3u8") > 0:
streams = hlsparse(options, self.http.request("get", self.url), self.url)
if extention:
options.output = "%s.ts" % options.output
for n in list(streams.keys()):
yield streams[n]
开发者ID:Fredro,项目名称:svtplay-dl,代码行数:30,代码来源:raw.py
示例9: get
def get(self):
data = self.get_urldata()
match = re.search('window.pagePlaylist = (.*);', data)
if not match:
yield ServiceError("Can't find video info")
return
try:
janson = json.loads(match.group(1))
except Exception:
yield ServiceError("Can't decode api request: {0}".format(match.group(1)))
return
parse = urlparse(self.url)
wanted_id = parse.path.split("/")[-1].split("-")[0]
for n in janson:
if wanted_id == str(n["id"]):
mrssxmlurl = "http://media-utils.mtvnservices.com/services/MediaGenerator/" \
"mgid:arc:video:mtv.se:{0}?acceptMethods=hls".format(n["video_token"])
hls_asset = self.http.request("get", mrssxmlurl)
xml = ET.XML(hls_asset.text)
if xml.find("./video") is not None and xml.find("./video").find("item") is not None and \
xml.find("./video").find("item").find("rendition") is not None and \
xml.find("./video").find("item").find("rendition").find("src") is not None:
hls_url = xml.find("./video").find("item").find("rendition").find("src").text
stream = hlsparse(self.config, self.http.request("get", hls_url), hls_url, output=self.output)
if stream:
for key in list(stream.keys()):
yield stream[key]
开发者ID:olof,项目名称:debian-svtplay-dl,代码行数:35,代码来源:mtvnn.py
示例10: get
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"])
开发者ID:TetragrammatonHermit,项目名称:svtplay-dl,代码行数:33,代码来源:vg.py
示例11: get
def get(self, options):
error, data = self.get_urldata()
if error:
log.error("Can't get the page")
return
if self.exclude(options):
return
match = re.search(r'"([^"]+geo.php)"', data)
if match:
error, data = get_http_data(match.group(1))
if error:
log.error("Cant get stream info")
return
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()[1])
if not match:
log.error("Can't find video info for: %s", self.url)
return
if match.group(1).endswith("mp4"):
yield HTTP(copy.copy(options), match.group(1), 800)
else:
m3u8_url = match.group(1)
options.live = checklive(m3u8_url)
yield HLS(copy.copy(options), m3u8_url, 800)
开发者ID:dapstr,项目名称:svtplay-dl,代码行数:33,代码来源:ruv.py
示例12: get
def get(self, options):
data = self.get_urldata()
if self.exclude(options):
yield ServiceError("Excluding video")
return
match = re.search("<link rel='shortlink' href='http://www.dplay.se/\?p=(\d+)", data)
if not match:
yield ServiceError("Can't find video id")
return
data = self.http.request("get", "http://geo.dplay.se/geo.js").text
dataj = json.loads(data)
geo = dataj["countryCode"]
timestamp = (int(time.time())+3600)*1000
cookie = {"dsc-geo": quote('{"countryCode":"%s","expiry":%s}' % (geo, timestamp))}
data = self.http.request("get", "https://secure.dplay.se/secure/api/v2/user/authorization/stream/%s?stream_type=hds" % match.group(1), cookies=cookie)
dataj = json.loads(data.text)
if "hds" in dataj:
streams = hdsparse(copy.copy(options), self.http.request("get", dataj["hds"], params={"hdcore": "3.8.0"}), dataj["hds"])
if streams:
for n in list(streams.keys()):
yield streams[n]
data = self.http.request("get", "https://secure.dplay.se/secure/api/v2/user/authorization/stream/%s?stream_type=hls" % match.group(1), cookies=cookie)
dataj = json.loads(data.text)
if "hls" in dataj:
streams = hlsparse(options, self.http.request("get", dataj["hls"]), dataj["hls"])
if streams:
for n in list(streams.keys()):
yield streams[n]
开发者ID:deadbeef84,项目名称:svtplay-dl,代码行数:31,代码来源:dplay.py
示例13: get
def get(self, options):
match = re.search("xmlUrl=([^ ]+)\" ", self.get_urldata())
if match:
xmlurl = unquote_plus(match.group(1))
else:
match = re.search("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)
开发者ID:antoneliasson,项目名称:svtplay-dl,代码行数:34,代码来源:expressen.py
示例14: get
def get(self):
data = self.get_urldata()
parse = urlparse(self.url)
match = re.search(r'^/([a-z]{2})/', parse.path)
if not match:
yield ServiceError("Cant county code")
return
res = self.http.get("http://www.pokemon.com/api/pokemontv/channels?region={0}".format(match.group(1)))
janson = res.json()
match = re.search('data-video-season="([0-9]+)"', data)
season = match.group(1)
match = re.search('data-video-episode="([0-9]+)"', data)
episode = match.group(1)
for i in janson:
for n in i["media"]:
if season == n["season"] and episode == n["episode"]:
stream = n["stream_url"]
self.output["title"] = "pokemon"
self.output["season"] = season
self.output["episode"] = episode
streams = hlsparse(self.config, self.http.request("get", stream), stream, output=self.output)
for n in list(streams.keys()):
yield streams[n]
开发者ID:olof,项目名称:debian-svtplay-dl,代码行数:28,代码来源:pokemon.py
示例15: get
def get(self):
if self.exclude():
return
extention = False
filename = os.path.basename(self.url[:self.url.rfind("/")])
if self.options.output and os.path.isdir(self.options.output):
self.options.output = os.path.join(os.path.dirname(self.options.output), filename)
extention = True
elif self.options.output is None:
self.options.output = filename
extention = True
streams = []
if re.search(".f4m", self.url):
if extention:
self.options.output = "{0}.flv".format(self.options.output)
streams.append(hdsparse(self.options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url))
if re.search(".m3u8", self.url):
streams.append(hlsparse(self.options, self.http.request("get", self.url), self.url))
if re.search(".mpd", self.url):
streams.append(dashparse(self.options, self.http.request("get", self.url), self.url))
for stream in streams:
if stream:
for n in list(stream.keys()):
yield stream[n]
开发者ID:olof,项目名称:svtplay-dl,代码行数:30,代码来源:raw.py
示例16: get
def get(self, options):
error, data = self.get_urldata()
if error:
log.error("Can't download webpage")
return
if self.exclude(options):
return
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")
return
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)
开发者ID:dapstr,项目名称:svtplay-dl,代码行数:26,代码来源:dbtv.py
示例17: get
def get(self):
parse = urlparse(self.url)
if not parse.path.startswith("/video"):
yield ServiceError("Can't find video info")
return
wanted_id = parse.path[7:]
current_time = int((datetime.utcnow() - datetime.utcfromtimestamp(0)).total_seconds() * 1000)
api_url = "https://www.atgplay.se/api/{0}/video/{1}".format(current_time, wanted_id)
video_assets = self.http.request("get", api_url)
try:
janson = json.loads(video_assets.text)
except json.decoder.JSONDecodeError:
yield ServiceError("Can't decode api request: {0}".format(video_assets.text))
return
if "title" in janson:
self.output["title"] = janson["title"]
if "urls" in janson:
for i in janson["urls"]:
if "m3u" == i:
stream = hlsparse(self.config, self.http.request("get", janson["urls"]["m3u"]), janson["urls"]["m3u"], output=self.output)
for key in list(stream.keys()):
yield stream[key]
开发者ID:spaam,项目名称:svtplay-dl,代码行数:29,代码来源:atg.py
示例18: get_video
def get_video(self, janson):
videos = janson["videos"][0]["media"]["streams"]
for i in videos:
if i["name"] == "auto":
hls = "{0}{1}".format(janson["videos"][0]["media"]["base"], i["url"])
streams = hlsparse(self.options, self.http.request("get", hls), hls)
return streams
开发者ID:magic75,项目名称:svtplay-dl,代码行数:7,代码来源:lemonwhale.py
示例19: get
def get(self):
data = self.get_urldata()
match = re.search(r'data-videoid="([^"]+)"', data)
if not match:
parse = urlparse(self.url)
match = re.search(r'video/(\d+)/', parse.fragment)
if not match:
yield ServiceError("Can't find video file for: {0}".format(self.url))
return
videoid = match.group(1)
data = self.http.request("get", "http://svp.vg.no/svp/api/v1/vgtv/assets/{0}?appName=vgtv-website".format(videoid)).text
jsondata = json.loads(data)
self.output["title"] = jsondata["title"]
if "hds" in jsondata["streamUrls"]:
streams = hdsparse(self.config, self.http.request("get", jsondata["streamUrls"]["hds"], params={"hdcore": "3.7.0"}),
jsondata["streamUrls"]["hds"], output=self.output)
for n in list(streams.keys()):
yield streams[n]
if "hls" in jsondata["streamUrls"]:
streams = hlsparse(self.config, self.http.request("get", jsondata["streamUrls"]["hls"]),
jsondata["streamUrls"]["hls"], output=self.output)
for n in list(streams.keys()):
yield streams[n]
if "mp4" in jsondata["streamUrls"]:
yield HTTP(copy.copy(self.config), jsondata["streamUrls"]["mp4"], output=self.output)
开发者ID:olof,项目名称:debian-svtplay-dl,代码行数:26,代码来源:vg.py
示例20: _get_static_video
def _get_static_video(self, options, videoid):
access = self._get_access_token(videoid)
if options.output_auto:
data = self.http.request("get", "https://api.twitch.tv/kraken/videos/v%s" % videoid)
if data.status_code == 404:
yield ServiceError("Can't find the video")
return
info = json.loads(data.text)
name = "twitch-%s-%s" % (info["channel"]["name"], filenamify(info["title"]))
directory = os.path.dirname(options.output)
if os.path.isdir(directory):
name = os.path.join(directory, name)
options.output = name
if "token" not in access:
raise TwitchUrlException('video', self.url)
nauth = quote_plus(str(access["token"]))
authsig = access["sig"]
url = "http://usher.twitch.tv/vod/%s?nauth=%s&nauthsig=%s" % (
videoid, nauth, authsig)
streams = hlsparse(options, self.http.request("get", url), url)
if streams:
for n in list(streams.keys()):
yield streams[n]
开发者ID:gusseleet,项目名称:svtplay-dl,代码行数:27,代码来源:twitch.py
注:本文中的svtplay_dl.fetcher.hls.hlsparse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论