mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-27 11:00:32 +08:00
commit
8e9a0f720c
17
douyu.py
17
douyu.py
@ -46,9 +46,8 @@ class DouYu:
|
|||||||
}
|
}
|
||||||
res = self.s.post(url, headers=headers, data=data).json()
|
res = self.s.post(url, headers=headers, data=data).json()
|
||||||
if 0 != res['error']:
|
if 0 != res['error']:
|
||||||
print('error at url:{}\nresponse:{}'.format(url, res))
|
raise Exception(res["msg"])
|
||||||
return None
|
return res['data']['rtmp_url'] + '/' + res['data']['rtmp_live']
|
||||||
return data['rtmp_url'] + '/' + data['rtmp_live']
|
|
||||||
|
|
||||||
def get_js(self):
|
def get_js(self):
|
||||||
result = re.search(r'(function ub98484234.*)\s(var.*)', self.res).group()
|
result = re.search(r'(function ub98484234.*)\s(var.*)', self.res).group()
|
||||||
@ -69,8 +68,10 @@ class DouYu:
|
|||||||
params += '&ver=219032101&rid={}&rate={}'.format(self.rid, self.live_rate)
|
params += '&ver=219032101&rid={}&rate={}'.format(self.rid, self.live_rate)
|
||||||
|
|
||||||
url = 'https://m.douyu.com/api/room/ratestream'
|
url = 'https://m.douyu.com/api/room/ratestream'
|
||||||
res = self.s.post(url, params=params).json()['data']
|
res = self.s.post(url, params=params).json()
|
||||||
return res['url']
|
if 0 != res['code']:
|
||||||
|
return None
|
||||||
|
return res['data']['url']
|
||||||
|
|
||||||
def get_pc_js(self, cdn='ws-h5'):
|
def get_pc_js(self, cdn='ws-h5'):
|
||||||
"""
|
"""
|
||||||
@ -97,8 +98,10 @@ class DouYu:
|
|||||||
|
|
||||||
params += '&cdn={}&rate={}'.format(cdn, self.live_rate)
|
params += '&cdn={}&rate={}'.format(cdn, self.live_rate)
|
||||||
url = 'https://www.douyu.com/lapi/live/getH5Play/{}'.format(self.rid)
|
url = 'https://www.douyu.com/lapi/live/getH5Play/{}'.format(self.rid)
|
||||||
res = self.s.post(url, params=params).json()['data']
|
res = self.s.post(url, params=params).json()
|
||||||
return res['rtmp_url'] + '/' + res['rtmp_live']
|
if 0 != res['error']:
|
||||||
|
return None
|
||||||
|
return res['data']['rtmp_url'] + '/' + res['data']['rtmp_live']
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
ret = []
|
ret = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user