mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-29 21:00:30 +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
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def get_real_url(rid):
|
def zhanqi(rid):
|
||||||
room_url = 'https://m.zhanqi.tv/api/static/v2.1/room/domain/' + str(rid) + '.json'
|
with requests.Session() as s:
|
||||||
try:
|
res = s.get('https://m.zhanqi.tv/api/static/v2.1/room/domain/{}.json'.format(rid))
|
||||||
response = requests.get(url=room_url).json()
|
try:
|
||||||
videoId = response.get('data').get('videoId')
|
res = res.json()
|
||||||
if videoId:
|
videoid = res['data']['videoId']
|
||||||
real_url = 'https://dlhdl-cdn.zhanqi.tv/zqlive/' + str(videoId) + '.flv'
|
status = res['data']['status']
|
||||||
else:
|
if status == '4':
|
||||||
real_url = '未开播'
|
url = 'https://dlhdl-cdn.zhanqi.tv/zqlive/{}.flv?get_url=1'.format(videoid)
|
||||||
except:
|
real_url = s.get(url).text
|
||||||
real_url = '直播间不存在'
|
else:
|
||||||
return real_url
|
real_url = '未开播'
|
||||||
|
except:
|
||||||
|
real_url = '直播间不存在'
|
||||||
|
return real_url
|
||||||
|
|
||||||
|
|
||||||
rid = input('请输入战旗直播房间号:\n')
|
if __name__ == '__main__':
|
||||||
real_url = get_real_url(rid)
|
r = input('输入战旗直播房间号:\n')
|
||||||
print('该直播间源地址为:\n' + real_url)
|
print(zhanqi(r))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user