1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-08-13 23:31:38 +08:00

Compare commits

..

No commits in common. "9709ef485f348f9c1424d7d3ba3a7699ef695bc9" and "0ab2f21c744975e4967e7878ce532e15b2ec25a0" have entirely different histories.

2 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@ class Douyu:
async with aiohttp.ClientSession() as session:
async with session.get('https://m.douyu.com/' + str(room_id)) as resp:
room_page = await resp.text()
room_id = re.findall(r'"rid":(\d{1,8})', room_page)[0]
room_id = re.findall(r'"rid":(\d{1,7})', room_page)[0]
reg_datas = []
data = f'type@=loginreq/roomid@={room_id}/'
s = pack('i', 9 + len(data)) * 2

View File

@ -22,7 +22,7 @@ class DouYu:
def __init__(self, rid):
"""
房间号通常为1~8位纯数字浏览器地址栏中看到的房间号不一定是真实rid.
房间号通常为1~7位纯数字浏览器地址栏中看到的房间号不一定是真实rid.
Args:
rid:
"""
@ -32,7 +32,7 @@ class DouYu:
self.s = requests.Session()
self.res = self.s.get('https://m.douyu.com/' + str(rid)).text
result = re.search(r'rid":(\d{1,8}),"vipId', self.res)
result = re.search(r'rid":(\d{1,7}),"vipId', self.res)
if result:
self.rid = result.group(1)
@ -61,7 +61,7 @@ class DouYu:
key = ''
if data:
rtmp_live = data['rtmp_live']
key = re.search(r'(\d{1,8}[0-9a-zA-Z]+)_?\d{0,4}(/playlist|.m3u8)', rtmp_live).group(1)
key = re.search(r'(\d{1,7}[0-9a-zA-Z]+)_?\d{0,4}(/playlist|.m3u8)', rtmp_live).group(1)
return error, key
def get_js(self):
@ -83,7 +83,7 @@ class DouYu:
url = 'https://m.douyu.com/api/room/ratestream'
res = self.s.post(url, params=params).text
key = re.search(r'(\d{1,8}[0-9a-zA-Z]+)_?\d{0,4}(.m3u8|/playlist)', res).group(1)
key = re.search(r'(\d{1,7}[0-9a-zA-Z]+)_?\d{0,4}(.m3u8|/playlist)', res).group(1)
return key