1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-06-17 08:25:25 +08:00

⚰️ Remove 火猫直播

-火猫直播官网一直打不开,应该已经倒闭了
-优化代码
This commit is contained in:
wbt5 2021-11-21 01:45:52 +08:00
parent 5131a8d5f6
commit c00b2d6337
No known key found for this signature in database
GPG Key ID: 92D5C42E815A2BD6

View File

@ -12,34 +12,33 @@ import re
class HuoMao: class HuoMao:
def __init__(self, rid): def __init__(self, rid):
"""
火猫直播已经倒闭了
Args:
rid: 房间号
"""
self.rid = rid self.rid = rid
@staticmethod
def get_time():
tt = str(int((time.time() * 1000)))
return tt
@staticmethod @staticmethod
def get_videoids(rid): def get_videoids(rid):
room_url = 'https://www.huomao.com/mobile/mob_live/' + str(rid) room_url = f'https://www.huomao.com/mobile/mob_live/{rid}'
response = requests.get(url=room_url).text response = requests.get(url=room_url).text
try: try:
videoids = re.findall(r'var stream = "([\w\W]+?)";', response)[0] videoids = re.findall(r'var stream = "([\w\W]+?)";', response)[0]
except: except IndexError:
videoids = 0 videoids = 0
return videoids return videoids
@staticmethod @staticmethod
def get_token(videoids, time): def get_token(videoids):
token = hashlib.md5((str(videoids) + 'huomaoh5room' + str(time) + tt = str(int((time.time() * 1000)))
'6FE26D855E1AEAE090E243EB1AF73685').encode('utf-8')).hexdigest() token = hashlib.md5(f'{videoids}huomaoh5room{tt}6FE26D855E1AEAE090E243EB1AF73685'.encode('utf-8')).hexdigest()
return token return token
def get_real_url(self): def get_real_url(self):
videoids = self.get_videoids(self.rid) videoids = self.get_videoids(self.rid)
if videoids: if videoids:
time = self.get_time() token = self.get_token(videoids)
token = self.get_token(videoids, time)
room_url = 'https://www.huomao.com/swf/live_data' room_url = 'https://www.huomao.com/swf/live_data'
post_data = { post_data = {
'cdns': 1, 'cdns': 1,