mirror of
https://github.com/wbt5/real-url.git
synced 2025-06-16 15:59:57 +08:00
⚡ 优化代码
This commit is contained in:
parent
cab036f982
commit
f26b0f4c03
5
95xiu.py
5
95xiu.py
@ -11,14 +11,14 @@ class JWXiu:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('http://www.95.cn/{}.html'.format(self.rid)).text
|
||||
res = s.get(f'https://www.95.cn/{self.rid}.html').text
|
||||
try:
|
||||
uid = re.search(r'"uid":(\d+),', res).group(1)
|
||||
status = re.search(r'"is_offline":"(\d)"', res).group(1)
|
||||
except AttributeError:
|
||||
raise Exception('没有找到直播间')
|
||||
if status == '0':
|
||||
real_url = 'http://play.95xiu.com/app/{}.flv'.format(uid)
|
||||
real_url = f'https://play1.95xiu.com/app/{uid}.flv'
|
||||
return real_url
|
||||
else:
|
||||
raise Exception('未开播')
|
||||
@ -36,4 +36,3 @@ def get_real_url(rid):
|
||||
if __name__ == '__main__':
|
||||
r = input('输入95秀房间号:\n')
|
||||
print(get_real_url(r))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user