1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-12-18 08:10:31 +08:00
zhibo-url/imifun.py
2020-07-31 19:40:29 +08:00

24 lines
658 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 艾米直播https://www.imifun.com/
import requests
import re
def imifun(rid):
with requests.Session() as s:
res = s.get('https://www.imifun.com/' + str(rid)).text
roomid = re.search(r"roomId:\s'([\w-]+)'", res)
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))
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入艾米直播房间号:\n')
print(imifun(r))