1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-06-16 15:59:57 +08:00

🐛 Fix 艾米直播

-更新正则以正确获取room_id
-优化代码
This commit is contained in:
wbt5 2021-11-21 01:56:50 +08:00
parent c00b2d6337
commit c0018d0fb1
No known key found for this signature in database
GPG Key ID: 92D5C42E815A2BD6

View File

@ -11,12 +11,12 @@ class IMFun:
def get_real_url(self):
with requests.Session() as s:
res = s.get('https://www.imifun.com/' + str(self.rid)).text
roomid = re.search(r"roomId:\s'([\w-]+)'", res)
res = s.get(f'https://www.imifun.com/{self.rid}').text
roomid = re.search(r'mixPkPlayUrl ="rtmp://wsmd.happyia.com/ivp/(\d+-\d+)"', res).group(1)
if roomid:
status = re.search(r"isLive:(\d),", res).group(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
else:
raise Exception('未开播')