mirror of
https://github.com/wbt5/real-url.git
synced 2025-06-16 15:59:57 +08:00
🎨 Improve KK直播
-优化代码
This commit is contained in:
parent
58d4d88942
commit
8b7635d2fc
14
kk.py
14
kk.py
@ -5,20 +5,24 @@ import requests
|
||||
class KK:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
KK直播
|
||||
Args:
|
||||
rid: 房间号
|
||||
"""
|
||||
self.rid = rid
|
||||
self.s = requests.Session()
|
||||
|
||||
def get_real_url(self):
|
||||
url = 'https://sapi.kktv1.com/meShow/entrance?parameter={}'
|
||||
parameter = {'FuncTag': 10005043, 'userId': '{}'.format(self.rid), 'platform': 1, 'a': 1, 'c': 100101}
|
||||
with requests.Session() as s:
|
||||
res = s.get(url.format(parameter)).json()
|
||||
parameter = {'FuncTag': 10005043, 'userId': f'{self.rid}', 'platform': 1, 'a': 1, 'c': 100101}
|
||||
res = self.s.get(url.format(parameter)).json()
|
||||
tagcode = res['TagCode']
|
||||
if tagcode == '00000000':
|
||||
if res.get('liveType', 0) == 1:
|
||||
roomid = res['roomId']
|
||||
parameter = {'FuncTag': 60001002, 'roomId': roomid, 'platform': 1, 'a': 1, 'c': 100101}
|
||||
with requests.Session() as s:
|
||||
res = s.get(url.format(parameter)).json()
|
||||
res = self.s.get(url.format(parameter)).json()
|
||||
real_url = res['liveStream']
|
||||
return real_url
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user