mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-28 20:35:55 +08:00
优化优酷直播
This commit is contained in:
parent
fe32942cdb
commit
6fa8047137
33
youku.py
33
youku.py
@ -1,18 +1,18 @@
|
||||
# 获取@优酷轮播台@的真实流媒体地址。
|
||||
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
|
||||
# liveId 是如下形式直播间链接“https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
|
||||
|
||||
|
||||
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
|
||||
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
|
||||
# liveId 是如下形式直播间链接:
|
||||
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
|
||||
import requests
|
||||
import time
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
|
||||
def get_real_url(liveId):
|
||||
def youku(liveid):
|
||||
try:
|
||||
tt = str(int(time.time()*1000))
|
||||
data = json.dumps({"liveId":liveId,"app":"Pc"}, separators=(',', ':'))
|
||||
tt = str(int(time.time() * 1000))
|
||||
data = json.dumps({'liveId': liveid, 'app': 'Pc'}, separators=(',', ':'))
|
||||
url = 'https://acs.youku.com/h5/mtop.youku.live.com.livefullinfo/1.0/?appKey=24679788'
|
||||
s = requests.Session()
|
||||
cookies = s.get(url).cookies
|
||||
@ -24,16 +24,15 @@ def get_real_url(liveId):
|
||||
'data': data
|
||||
}
|
||||
response = s.get(url, params=params).json()
|
||||
name = response.get('data').get('data').get('name')
|
||||
streamName = response.get('data').get('data').get('stream')[0].get('streamName')
|
||||
real_url = 'http://lvo-live.youku.com/vod2live/{}_mp4hd2v3.m3u8?&expire=21600&psid=1&ups_ts={}&vkey='.format(streamName, int(time.time()))
|
||||
# name = response.get('data').get('data').get('name')
|
||||
streamname = response.get('data').get('data').get('stream')[0].get('streamName')
|
||||
real_url = 'http://lvo-live.youku.com/vod2live/{}_mp4hd2v3.m3u8?&expire=21600&psid=1&ups_ts={}&vkey='.format(
|
||||
streamname, int(time.time()))
|
||||
except:
|
||||
name = real_url = '请求错误'
|
||||
return name, real_url
|
||||
real_url = '请求错误'
|
||||
return real_url
|
||||
|
||||
|
||||
liveId = input('请输入优酷轮播台liveId:\n')
|
||||
real_url = get_real_url(liveId)
|
||||
print('该直播间地址为:')
|
||||
print(real_url[0])
|
||||
print(real_url[1])
|
||||
if __name__ == '__main__':
|
||||
r = input('输入优酷轮播台liveId:\n')
|
||||
print(youku(r))
|
||||
|
Loading…
x
Reference in New Issue
Block a user