mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-26 02:21:43 +08:00
🐛 Fix 艾米直播
-更新正则以正确获取room_id -优化代码
This commit is contained in:
parent
c00b2d6337
commit
c0018d0fb1
@ -11,12 +11,12 @@ class IMFun:
|
|||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
with requests.Session() as s:
|
with requests.Session() as s:
|
||||||
res = s.get('https://www.imifun.com/' + str(self.rid)).text
|
res = s.get(f'https://www.imifun.com/{self.rid}').text
|
||||||
roomid = re.search(r"roomId:\s'([\w-]+)'", res)
|
roomid = re.search(r'mixPkPlayUrl ="rtmp://wsmd.happyia.com/ivp/(\d+-\d+)"', res).group(1)
|
||||||
if roomid:
|
if roomid:
|
||||||
status = re.search(r"isLive:(\d),", res).group(1)
|
status = re.search(r"isLive:(\d),", res).group(1)
|
||||||
if status == '1':
|
if status == '1':
|
||||||
real_url = 'https://wsmd.happyia.com/ivp/{}.flv'.format(roomid.group(1))
|
real_url = f'https://wsmd.happyia.com/ivp/{roomid}.flv'
|
||||||
return real_url
|
return real_url
|
||||||
else:
|
else:
|
||||||
raise Exception('未开播')
|
raise Exception('未开播')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user