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

🐛 Fix 六间房直播

-修复正则匹配不到的问题
-优化直播地址拼接方式
-优化代码
This commit is contained in:
wbt5 2021-11-20 23:46:45 +08:00
parent ebb319a83f
commit 315ce05dd1
No known key found for this signature in database
GPG Key ID: 92D5C42E815A2BD6

11
v6cn.py
View File

@ -11,14 +11,14 @@ class V6CN:
def get_real_url(self):
try:
response = requests.get('https://v.6.cn/' + str(self.rid)).text
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid = result[0]
flvtitle = 'v{}-{}'.format(*result)
response = requests.get('https://rio.6rooms.com/live/?s=' + str(uid)).text
hip = 'https://' + re.findall(r'<watchip>(.*\.xiu123\.cn).*</watchip>', response)[0]
real_url = [hip + '/' + flvtitle + '/playlist.m3u8', hip + '/httpflv/' + flvtitle]
except:
response = requests.get(f'https://rio.6rooms.com/live/?s={uid}').text
hip = 'https://' + re.search(r'<watchip>(.*\.com).*?</watchip>', response).group(1)
real_url = [f'{hip}/{flvtitle}/palylist.m3u8', f'{hip}/httpflv/{flvtitle}']
except Exception:
raise Exception('直播间不存在或未开播')
return real_url
@ -35,4 +35,3 @@ def get_real_url(rid):
if __name__ == '__main__':
r = input('请输入六间房直播房间号:\n')
print(get_real_url(r))