mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-31 22:13:05 +08:00
新增哔哩哔哩直播源;疑似部分国外IP无法GET到正确数据,待验证
This commit is contained in:
parent
b9dc370e96
commit
d28aae5bad
@ -25,10 +25,14 @@ def get_real_url(rid):
|
|||||||
if live_status:
|
if live_status:
|
||||||
room_url = 'https://api.live.bilibili.com/room/v1/Room/playUrl?cid=' +str(room_id) + '&platform=h5&otype=json&quality=4'
|
room_url = 'https://api.live.bilibili.com/room/v1/Room/playUrl?cid=' +str(room_id) + '&platform=h5&otype=json&quality=4'
|
||||||
response = requests.get(url=room_url).json()
|
response = requests.get(url=room_url).json()
|
||||||
result = response.get('data').get('durl')[0].get('url')
|
durl = response.get('data').get('durl', 0)
|
||||||
pattern = r'.com/live-[\S]*/([\s\S]*.m3u8)'
|
if durl:
|
||||||
pattern_result = re.findall(pattern, result, re.I)[0]
|
result = durl[0].get('url')
|
||||||
real_url = 'https://cn-hbxy-cmcc-live-01.live-play.acgvideo.com/live-bvc/' + pattern_result
|
pattern = r'.com/live-[\S]*/([\s\S]*.m3u8)'
|
||||||
|
pattern_result = re.findall(pattern, result, re.I)[0]
|
||||||
|
real_url = 'https://cn-hbxy-cmcc-live-01.live-play.acgvideo.com/live-bvc/' + pattern_result
|
||||||
|
else:
|
||||||
|
real_url = '疑似部分国外IP无法GET到正确数据,待验证'
|
||||||
else:
|
else:
|
||||||
real_url = '未开播或直播间不存在'
|
real_url = '未开播或直播间不存在'
|
||||||
return real_url
|
return real_url
|
||||||
|
Loading…
x
Reference in New Issue
Block a user