本文整理汇总了Python中ykdl.videoinfo.VideoInfo.streams[stream['type']]方法的典型用法代码示例。如果您正苦于以下问题:Python VideoInfo.streams[stream['type']]方法的具体用法?Python VideoInfo.streams[stream['type']]怎么用?Python VideoInfo.streams[stream['type']]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ykdl.videoinfo.VideoInfo
的用法示例。
在下文中一共展示了VideoInfo.streams[stream['type']]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare
# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import streams[stream['type']] [as 别名]
def prepare(self):
info = VideoInfo(self.name, True)
html = get_content(self.url)
info.title = match1(html, '<title>([^<]+)').split('_')[0]
video_name = match1(html, 'getFlash\("[0-9]+","([^"]+)')
params = { 'streamtype':'live',
'VideoIDS': video_name,
'cdns' : '1'
}
form = urlencode(params)
content = get_content(self.live_base,data=compact_bytes(form, 'utf-8'),charset = 'utf-8')
stream_data = json.loads(content)
assert stream_data["roomStatus"] == "1", "The live stream is not online! "
for stream in stream_data["streamList"]:
if stream['default'] == 1:
defstream = stream['list']
for stream in defstream:
info.stream_types.append(stream['type'])
info.streams[stream['type']] = {'container': 'flv', 'video_profile': self.stream_2_profile[stream['type']], 'src' : [stream['url']], 'size': float('inf')}
info.stream_types = sorted(info.stream_types, key = self.supported_stream_types.index)
return info
示例2: prepare
# 需要导入模块: from ykdl.videoinfo import VideoInfo [as 别名]
# 或者: from ykdl.videoinfo.VideoInfo import streams[stream['type']] [as 别名]
def prepare(self):
info = VideoInfo(self.name, True)
html = get_content(self.url)
info.title = match1(html, '<title>([^<]+)').split('_')[0]
data = json.loads(match1(html, 'channelOneInfo = ({.+?});'))
tag_from = 'huomaoh5room'
tn = str(int(time.time()))
sign_context = data['stream'] + tag_from + tn + SECRETKEY
token = hashlib.md5(compact_bytes(sign_context, 'utf-8')).hexdigest()
params = { 'streamtype':'live',
'VideoIDS': data['stream'],
'time': tn,
'cdns' : '1',
'from': tag_from,
'token': token
}
content = get_content(self.live_base, data=compact_bytes(urlencode(params), 'utf-8'), charset='utf-8')
stream_data = json.loads(content)
assert stream_data["roomStatus"] == "1", "The live stream is not online! "
for stream in stream_data["streamList"]:
if stream['default'] == 1:
defstream = stream['list']
for stream in defstream:
info.stream_types.append(stream['type'])
info.streams[stream['type']] = {'container': 'flv', 'video_profile': self.stream_2_profile[stream['type']], 'src' : [stream['url']], 'size': float('inf')}
info.stream_types = sorted(info.stream_types, key = self.supported_stream_types.index)
return info