mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-29 04:42:13 +08:00
优化战旗直播
This commit is contained in:
parent
183d14aff8
commit
73611d4d43
39
zhanqi.py
39
zhanqi.py
@ -1,24 +1,25 @@
|
||||
# 获取战旗直播(战旗TV)的真实流媒体地址。
|
||||
# 默认画质为超清
|
||||
|
||||
|
||||
# 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
|
||||
# 默认最高画质
|
||||
import requests
|
||||
|
||||
|
||||
def get_real_url(rid):
|
||||
room_url = 'https://m.zhanqi.tv/api/static/v2.1/room/domain/' + str(rid) + '.json'
|
||||
try:
|
||||
response = requests.get(url=room_url).json()
|
||||
videoId = response.get('data').get('videoId')
|
||||
if videoId:
|
||||
real_url = 'https://dlhdl-cdn.zhanqi.tv/zqlive/' + str(videoId) + '.flv'
|
||||
else:
|
||||
real_url = '未开播'
|
||||
except:
|
||||
real_url = '直播间不存在'
|
||||
return real_url
|
||||
def zhanqi(rid):
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://m.zhanqi.tv/api/static/v2.1/room/domain/{}.json'.format(rid))
|
||||
try:
|
||||
res = res.json()
|
||||
videoid = res['data']['videoId']
|
||||
status = res['data']['status']
|
||||
if status == '4':
|
||||
url = 'https://dlhdl-cdn.zhanqi.tv/zqlive/{}.flv?get_url=1'.format(videoid)
|
||||
real_url = s.get(url).text
|
||||
else:
|
||||
real_url = '未开播'
|
||||
except:
|
||||
real_url = '直播间不存在'
|
||||
return real_url
|
||||
|
||||
|
||||
rid = input('请输入战旗直播房间号:\n')
|
||||
real_url = get_real_url(rid)
|
||||
print('该直播间源地址为:\n' + real_url)
|
||||
if __name__ == '__main__':
|
||||
r = input('输入战旗直播房间号:\n')
|
||||
print(zhanqi(r))
|
||||
|
Loading…
x
Reference in New Issue
Block a user