mirror of
https://github.com/wbt5/real-url.git
synced 2025-06-17 08:25:25 +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:
|
class KK:
|
||||||
|
|
||||||
def __init__(self, rid):
|
def __init__(self, rid):
|
||||||
|
"""
|
||||||
|
KK直播
|
||||||
|
Args:
|
||||||
|
rid: 房间号
|
||||||
|
"""
|
||||||
self.rid = rid
|
self.rid = rid
|
||||||
|
self.s = requests.Session()
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
url = 'https://sapi.kktv1.com/meShow/entrance?parameter={}'
|
url = 'https://sapi.kktv1.com/meShow/entrance?parameter={}'
|
||||||
parameter = {'FuncTag': 10005043, 'userId': '{}'.format(self.rid), 'platform': 1, 'a': 1, 'c': 100101}
|
parameter = {'FuncTag': 10005043, 'userId': f'{self.rid}', 'platform': 1, 'a': 1, 'c': 100101}
|
||||||
with requests.Session() as s:
|
res = self.s.get(url.format(parameter)).json()
|
||||||
res = s.get(url.format(parameter)).json()
|
|
||||||
tagcode = res['TagCode']
|
tagcode = res['TagCode']
|
||||||
if tagcode == '00000000':
|
if tagcode == '00000000':
|
||||||
if res.get('liveType', 0) == 1:
|
if res.get('liveType', 0) == 1:
|
||||||
roomid = res['roomId']
|
roomid = res['roomId']
|
||||||
parameter = {'FuncTag': 60001002, 'roomId': roomid, 'platform': 1, 'a': 1, 'c': 100101}
|
parameter = {'FuncTag': 60001002, 'roomId': roomid, 'platform': 1, 'a': 1, 'c': 100101}
|
||||||
with requests.Session() as s:
|
res = self.s.get(url.format(parameter)).json()
|
||||||
res = s.get(url.format(parameter)).json()
|
|
||||||
real_url = res['liveStream']
|
real_url = res['liveStream']
|
||||||
return real_url
|
return real_url
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user