mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-29 21:00:30 +08:00
Compare commits
3 Commits
28409ccd41
...
cd9e41e505
Author | SHA1 | Date | |
---|---|---|---|
|
cd9e41e505 | ||
|
4b1a0a2f80 | ||
|
14e2cf7817 |
15
17live.py
15
17live.py
@ -7,21 +7,26 @@ import requests
|
|||||||
class Live17:
|
class Live17:
|
||||||
|
|
||||||
def __init__(self, rid):
|
def __init__(self, rid):
|
||||||
self.rid = rid
|
"""
|
||||||
# 可能需要挂代理。
|
# 可能需要挂代理。
|
||||||
# self.proxies = {
|
# self.proxies = {
|
||||||
# "http": "http://xxxx:1080",
|
# "http": "http://xxxx:1080",
|
||||||
# "https": "http://xxxx:1080",
|
# "https": "http://xxxx:1080",
|
||||||
# }
|
# }
|
||||||
|
Args:
|
||||||
|
rid:
|
||||||
|
"""
|
||||||
|
self.rid = rid
|
||||||
|
self.BASE_URL = 'https://api-dsa.17app.co/api/v1/lives/'
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
try:
|
try:
|
||||||
# response = requests.get(url='https://api-dsa.17app.co/api/v1/lives/' + self.rid, proxies=self.proxies).json()
|
# res = requests.get(f'{self.BASE_URL}{self.rid}', proxies=self.proxies).json()
|
||||||
response = requests.get(url='https://api-dsa.17app.co/api/v1/lives/' + self.rid).json()
|
res = requests.get(f'{self.BASE_URL}{self.rid}').json()
|
||||||
real_url_default = response.get('rtmpUrls')[0].get('url')
|
real_url_default = res.get('rtmpUrls')[0].get('url')
|
||||||
real_url_modify = real_url_default.replace('global-pull-rtmp.17app.co', 'china-pull-rtmp-17.tigafocus.com')
|
real_url_modify = real_url_default.replace('global-pull-rtmp.17app.co', 'china-pull-rtmp-17.tigafocus.com')
|
||||||
real_url = [real_url_modify, real_url_default]
|
real_url = [real_url_modify, real_url_default]
|
||||||
except:
|
except Exception:
|
||||||
raise Exception('直播间不存在或未开播')
|
raise Exception('直播间不存在或未开播')
|
||||||
return real_url
|
return real_url
|
||||||
|
|
||||||
|
7
51lm.py
7
51lm.py
@ -10,12 +10,13 @@ class LM:
|
|||||||
|
|
||||||
def __init__(self, rid):
|
def __init__(self, rid):
|
||||||
self.rid = rid
|
self.rid = rid
|
||||||
|
self.BASE_URL = 'https://www.51lm.tv/live/room/info/basic'
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
roominfo = {'programId': self.rid}
|
roominfo = {'programId': self.rid}
|
||||||
|
|
||||||
def g(d):
|
def g(d):
|
||||||
return hashlib.md5((d + '#' + urlencode(roominfo) + '#Ogvbm2ZiKE').encode('utf-8')).hexdigest()
|
return hashlib.md5(f'{d}#{urlencode(roominfo)}#Ogvbm2ZiKE'.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
lminfo = {
|
lminfo = {
|
||||||
'h': int(time.time()) * 1000,
|
'h': int(time.time()) * 1000,
|
||||||
@ -27,9 +28,9 @@ class LM:
|
|||||||
'w': 'a710244508d3cc14f50d24e9fecc496a'
|
'w': 'a710244508d3cc14f50d24e9fecc496a'
|
||||||
}
|
}
|
||||||
u = g(urlencode(lminfo))
|
u = g(urlencode(lminfo))
|
||||||
lminfo = 'G=' + u + '&' + urlencode(lminfo)
|
lminfo = f'G={u}&{urlencode(lminfo)}'
|
||||||
with requests.Session() as s:
|
with requests.Session() as s:
|
||||||
res = s.post('https://www.51lm.tv/live/room/info/basic', json=roominfo, headers={'lminfo': lminfo}).json()
|
res = s.post(self.BASE_URL, json=roominfo, headers={'lminfo': lminfo}).json()
|
||||||
code = res['code']
|
code = res['code']
|
||||||
if code == 200:
|
if code == 200:
|
||||||
status = res['data']['isLiving']
|
status = res['data']['isLiving']
|
||||||
|
15
zhibotv.py
15
zhibotv.py
@ -10,16 +10,25 @@ import requests
|
|||||||
class ZhiBotv:
|
class ZhiBotv:
|
||||||
|
|
||||||
def __init__(self, rid):
|
def __init__(self, rid):
|
||||||
|
"""
|
||||||
|
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
|
||||||
|
Args:
|
||||||
|
rid:房间号
|
||||||
|
"""
|
||||||
self.rid = rid
|
self.rid = rid
|
||||||
self.params = {
|
self.params = {
|
||||||
|
|
||||||
'token': '',
|
'token': '',
|
||||||
'roomId': self.rid,
|
'roomId': self.rid,
|
||||||
'angleId': '',
|
'angleId': '',
|
||||||
'lineId': '',
|
'lineId': '',
|
||||||
'definition': 'hd',
|
'definition': 'hd',
|
||||||
'statistics': 'pc|web|1.0.0|0|0|0|local|5.0.1',
|
'statistics': 'pc|web|1.0.0|0|0|0|local|5.0.1',
|
||||||
|
}
|
||||||
|
self.BASE_URL = 'https://rest.zhibo.tv/room/get-pull-stream-info-v430'
|
||||||
|
self.HEADERS = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
|
||||||
|
'Chrome/95.0.4638.69 Safari/537.36 ',
|
||||||
|
'Referer': 'https://www.zhibo.tv/live/'
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
@ -29,7 +38,7 @@ class ZhiBotv:
|
|||||||
:return: url
|
:return: url
|
||||||
"""
|
"""
|
||||||
with requests.Session() as s:
|
with requests.Session() as s:
|
||||||
res = s.get('https://rest.zhibo.tv/room/get-pull-stream-info-v430', params=self.params).json()
|
res = s.get(self.BASE_URL, params=self.params, headers=self.HEADERS).json()
|
||||||
if 'hlsHUrl' in res['data']:
|
if 'hlsHUrl' in res['data']:
|
||||||
url = res['data'].get('hlsHUrl')
|
url = res['data'].get('hlsHUrl')
|
||||||
if url:
|
if url:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user