mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-27 19:10:32 +08:00
新增获取虎牙直播源地址
This commit is contained in:
parent
db4fc7b516
commit
6bb49cb050
20
get_hy_real_url.py
Normal file
20
get_hy_real_url.py
Normal file
@ -0,0 +1,20 @@
|
||||
import requests
|
||||
import re
|
||||
|
||||
|
||||
def get_real_url(rid):
|
||||
room_url = 'https://m.huya.com/' + rid
|
||||
header = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Mobile Safari/537.36'
|
||||
}
|
||||
response = requests.get(url=room_url, headers=header)
|
||||
pattern = r"hasvedio: '([\s\S]*.m3u8)"
|
||||
result = re.findall(pattern, response.text, re.I)
|
||||
real_url = result[0]
|
||||
return real_url
|
||||
|
||||
|
||||
rid = input('请输入虎牙房间号:\n')
|
||||
real_url = get_real_url(rid)
|
||||
print('该直播间地址为:\n' + real_url)
|
Loading…
x
Reference in New Issue
Block a user