mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-27 11:00:32 +08:00
🎨 Improve 搜狐千帆直播
-优化代码
This commit is contained in:
parent
ccc5598774
commit
df10de8686
13
qf.py
13
qf.py
@ -8,14 +8,19 @@ import re
|
||||
class QF:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
搜狐千帆直播可以直接在网页源码里找到播放地址
|
||||
Args:
|
||||
rid: 数字直播间号
|
||||
"""
|
||||
self.rid = rid
|
||||
self.s = requests.Session()
|
||||
|
||||
def get_real_url(self):
|
||||
try:
|
||||
response = requests.post(url='https://qf.56.com/' + self.rid).text
|
||||
real_url = re.findall(r"flvUrl:'(.*)\?wsSecret", response)
|
||||
real_url = real_url[0]
|
||||
except:
|
||||
res = self.s.post(url=f'https://qf.56.com/{self.rid}').text
|
||||
real_url = re.search(r"flvUrl:'(.*)\?wsSecret", res).group(1)
|
||||
except Exception:
|
||||
raise Exception('直播间不存在或未开播')
|
||||
return real_url
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user