mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-29 21:00:30 +08:00
Compare commits
14 Commits
4cb2edc05a
...
c0018d0fb1
Author | SHA1 | Date | |
---|---|---|---|
|
c0018d0fb1 | ||
|
c00b2d6337 | ||
|
5131a8d5f6 | ||
|
8dbe5981e2 | ||
|
41cb50bede | ||
|
315ce05dd1 | ||
|
ebb319a83f | ||
|
3ff9c78da2 | ||
|
5a175ec283 | ||
|
2db1b08b74 | ||
|
3d0b32c531 | ||
|
7a0320b762 | ||
|
5f429990e4 | ||
|
a82ce4b08f |
23
huomao.py
23
huomao.py
@ -12,34 +12,33 @@ import re
|
||||
class HuoMao:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
火猫直播已经倒闭了
|
||||
Args:
|
||||
rid: 房间号
|
||||
"""
|
||||
self.rid = rid
|
||||
|
||||
@staticmethod
|
||||
def get_time():
|
||||
tt = str(int((time.time() * 1000)))
|
||||
return tt
|
||||
|
||||
@staticmethod
|
||||
def get_videoids(rid):
|
||||
room_url = 'https://www.huomao.com/mobile/mob_live/' + str(rid)
|
||||
room_url = f'https://www.huomao.com/mobile/mob_live/{rid}'
|
||||
response = requests.get(url=room_url).text
|
||||
try:
|
||||
videoids = re.findall(r'var stream = "([\w\W]+?)";', response)[0]
|
||||
except:
|
||||
except IndexError:
|
||||
videoids = 0
|
||||
return videoids
|
||||
|
||||
@staticmethod
|
||||
def get_token(videoids, time):
|
||||
token = hashlib.md5((str(videoids) + 'huomaoh5room' + str(time) +
|
||||
'6FE26D855E1AEAE090E243EB1AF73685').encode('utf-8')).hexdigest()
|
||||
def get_token(videoids):
|
||||
tt = str(int((time.time() * 1000)))
|
||||
token = hashlib.md5(f'{videoids}huomaoh5room{tt}6FE26D855E1AEAE090E243EB1AF73685'.encode('utf-8')).hexdigest()
|
||||
return token
|
||||
|
||||
def get_real_url(self):
|
||||
videoids = self.get_videoids(self.rid)
|
||||
if videoids:
|
||||
time = self.get_time()
|
||||
token = self.get_token(videoids, time)
|
||||
token = self.get_token(videoids)
|
||||
room_url = 'https://www.huomao.com/swf/live_data'
|
||||
post_data = {
|
||||
'cdns': 1,
|
||||
|
@ -11,12 +11,12 @@ class IMFun:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://www.imifun.com/' + str(self.rid)).text
|
||||
roomid = re.search(r"roomId:\s'([\w-]+)'", res)
|
||||
res = s.get(f'https://www.imifun.com/{self.rid}').text
|
||||
roomid = re.search(r'mixPkPlayUrl ="rtmp://wsmd.happyia.com/ivp/(\d+-\d+)"', res).group(1)
|
||||
if roomid:
|
||||
status = re.search(r"isLive:(\d),", res).group(1)
|
||||
if status == '1':
|
||||
real_url = 'https://wsmd.happyia.com/ivp/{}.flv'.format(roomid.group(1))
|
||||
real_url = f'https://wsmd.happyia.com/ivp/{roomid}.flv'
|
||||
return real_url
|
||||
else:
|
||||
raise Exception('未开播')
|
||||
|
32
renren.py
32
renren.py
@ -2,36 +2,28 @@
|
||||
|
||||
import requests
|
||||
import re
|
||||
import hashlib
|
||||
|
||||
|
||||
class RenRen:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
直播间地址形式:http://activity.renren.com/live/liveroom/970302934_21348
|
||||
rid即970302934_21348
|
||||
Args:
|
||||
rid:房间号
|
||||
"""
|
||||
self.rid = rid
|
||||
self.s = requests.Session()
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('http://activity.renren.com/liveroom/' + str(self.rid))
|
||||
livestate = re.search(r'"liveState":(\d)', res.text)
|
||||
if livestate:
|
||||
res = self.s.get(f'http://activity.renren.com/live/liveroom/{self.rid}').text
|
||||
try:
|
||||
s = re.search(r'"playUrl":"([\s\S]*?)"', res.text).group(1)
|
||||
if livestate.group(1) == '0':
|
||||
# accesskey = re.search(r'accesskey=(\w+)', s).group(1)
|
||||
# expire = re.search(r'expire=(\d+)', s).group(1)
|
||||
# live = re.search(r'(/live/\d+)', s).group(1)
|
||||
# c = accesskey + expire + live
|
||||
# key = hashlib.md5(c.encode('utf-8')).hexdigest()
|
||||
# e = s.split('?')[0].split('/')[4]
|
||||
# t = 'http://ksy-hls.renren.com/live/' + e + '/index.m3u8?key=' + key
|
||||
return s
|
||||
elif livestate.group(1) == '1':
|
||||
return '回放:' + s
|
||||
except IndexError:
|
||||
s = re.search(r'playUrl":"(.*?)"', res)
|
||||
play_url = s.group(1)
|
||||
return play_url
|
||||
except Exception:
|
||||
raise Exception('解析错误')
|
||||
else:
|
||||
raise Exception('直播间不存在')
|
||||
|
||||
|
||||
def get_real_url(rid):
|
||||
|
20
showself.py
20
showself.py
@ -10,10 +10,14 @@ class ShowSelf:
|
||||
|
||||
def __init__(self, rid):
|
||||
self.rid = rid
|
||||
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 '
|
||||
}
|
||||
self.s = requests.Session()
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://service.showself.com/v2/custuser/visitor').json()
|
||||
res = self.s.get('https://service.showself.com/v2/custuser/visitor', headers=self.headers).json()
|
||||
uid = res['data']['uid']
|
||||
accesstoken = sessionid = res['data']['sessionid']
|
||||
params = {
|
||||
@ -27,13 +31,13 @@ class ShowSelf:
|
||||
'sessionid': sessionid,
|
||||
'sessionId': sessionid
|
||||
}
|
||||
# 合并两个字典
|
||||
data = dict(params, **payload)
|
||||
data = urlencode(sorted(data.items(), key=lambda d: d[0])) + 'sh0wselfh5'
|
||||
data = f'{urlencode(sorted(data.items(), key=lambda d: d[0]))}sh0wselfh5'
|
||||
_ajaxData1 = hashlib.md5(data.encode('utf-8')).hexdigest()
|
||||
payload['_ajaxData1'] = _ajaxData1
|
||||
url = 'https://service.showself.com/v2/rooms/{}/members?{}'.format(self.rid, urlencode(params))
|
||||
with requests.Session() as s:
|
||||
res = s.post(url, json=payload)
|
||||
url = f'https://service.showself.com/v2/rooms/{self.rid}/members?{urlencode(params)}'
|
||||
res = self.s.post(url, json=payload, headers=self.headers)
|
||||
if res.status_code == 200:
|
||||
res = res.json()
|
||||
statuscode = res['status']['statuscode']
|
||||
@ -60,5 +64,5 @@ def get_real_url(rid):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
rid = input('输入秀色直播房间号:\n')
|
||||
print(get_real_url(rid))
|
||||
r = input('输入秀色直播房间号:\n')
|
||||
print(get_real_url(r))
|
||||
|
2
tuho.py
2
tuho.py
@ -11,7 +11,7 @@ class TuHo:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://www.tuho.tv/' + str(self.rid)).text
|
||||
res = s.get(f'https://www.tuho.tv/{self.rid}').text
|
||||
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)', res)
|
||||
if flv:
|
||||
status = re.search(r'isPlaying\s:\s(\w+),', res).group(1)
|
||||
|
11
v6cn.py
11
v6cn.py
@ -11,14 +11,14 @@ class V6CN:
|
||||
|
||||
def get_real_url(self):
|
||||
try:
|
||||
response = requests.get('https://v.6.cn/' + str(self.rid)).text
|
||||
response = requests.get(f'https://v.6.cn/{self.rid}').text
|
||||
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
|
||||
uid = result[0]
|
||||
flvtitle = 'v{}-{}'.format(*result)
|
||||
response = requests.get('https://rio.6rooms.com/live/?s=' + str(uid)).text
|
||||
hip = 'https://' + re.findall(r'<watchip>(.*\.xiu123\.cn).*</watchip>', response)[0]
|
||||
real_url = [hip + '/' + flvtitle + '/playlist.m3u8', hip + '/httpflv/' + flvtitle]
|
||||
except:
|
||||
response = requests.get(f'https://rio.6rooms.com/live/?s={uid}').text
|
||||
hip = 'https://' + re.search(r'<watchip>(.*\.com).*?</watchip>', response).group(1)
|
||||
real_url = [f'{hip}/{flvtitle}/palylist.m3u8', f'{hip}/httpflv/{flvtitle}']
|
||||
except Exception:
|
||||
raise Exception('直播间不存在或未开播')
|
||||
return real_url
|
||||
|
||||
@ -35,4 +35,3 @@ def get_real_url(rid):
|
||||
if __name__ == '__main__':
|
||||
r = input('请输入六间房直播房间号:\n')
|
||||
print(get_real_url(r))
|
||||
|
||||
|
2
wali.py
2
wali.py
@ -11,7 +11,7 @@ class WaLi:
|
||||
def get_real_url(self):
|
||||
zuid = self.rid.split('_')[0]
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://s.zb.mi.com/get_liveinfo?lid={}&zuid={}'.format(self.rid, zuid)).json()
|
||||
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
|
||||
status = res['data']['status']
|
||||
if status == 1:
|
||||
flv = res['data']['video']['flv']
|
||||
|
8
woxiu.py
8
woxiu.py
@ -10,15 +10,15 @@ class WoXiu:
|
||||
|
||||
def get_real_url(self):
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) '
|
||||
'Version/11.0 Mobile/15A372 Safari/604.1'
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
|
||||
'like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 '
|
||||
}
|
||||
url = 'https://m.woxiu.com/index.php?action=M/Live&do=LiveInfo&room_id={}'.format(self.rid)
|
||||
url = f'https://m.woxiu.com/index.php?action=M/Live&do=LiveInfo&room_id={self.rid}'
|
||||
with requests.Session() as s:
|
||||
res = s.get(url, headers=headers)
|
||||
try:
|
||||
res = res.json()
|
||||
except:
|
||||
except Exception:
|
||||
raise Exception('直播间不存在')
|
||||
status = res['online']
|
||||
if status:
|
||||
|
@ -27,7 +27,7 @@ class XunLei:
|
||||
'uuid': self.rid,
|
||||
}
|
||||
data = urlencode(params)
|
||||
p = hashlib.md5((u + data + f).encode('utf-8')).hexdigest()
|
||||
p = hashlib.md5(f'{u}{data}{f}'.encode('utf-8')).hexdigest()
|
||||
params['sign'] = p
|
||||
with requests.Session() as s:
|
||||
res = s.get(url, params=params, headers=headers).json()
|
||||
@ -54,4 +54,3 @@ def get_real_url(rid):
|
||||
if __name__ == '__main__':
|
||||
r = input('请输入迅雷直播房间号:\n')
|
||||
print(get_real_url(r))
|
||||
|
||||
|
37
yizhibo.py
37
yizhibo.py
@ -7,33 +7,24 @@ import re
|
||||
class YiZhiBo:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
一直播需要传入直播间的完整地址
|
||||
Args:
|
||||
rid:完整地址
|
||||
"""
|
||||
self.rid = rid
|
||||
self.s = requests.Session()
|
||||
|
||||
def get_real_url(self):
|
||||
try:
|
||||
scid = re.findall(r'/l/(\S*).html', self.rid)[0]
|
||||
flvurl = 'http://alcdn.f01.xiaoka.tv/live/{}.flv'.format(scid)
|
||||
m3u8url = 'http://al01.alcdn.hls.xiaoka.tv/live/{}.m3u8'.format(scid)
|
||||
rtmpurl = 'rtmp://alcdn.r01.xiaoka.tv/live/live/{}'.format(scid)
|
||||
real_url = {
|
||||
'flvurl': flvurl,
|
||||
'm3u8url': m3u8url,
|
||||
'rtmpurl': rtmpurl
|
||||
}
|
||||
except:
|
||||
raise Exception('链接错误')
|
||||
return real_url
|
||||
|
||||
def get_status(self):
|
||||
try:
|
||||
scid = re.findall(r'/l/(\S*).html', self.rid)[0]
|
||||
response = requests.get(
|
||||
url='https://m.yizhibo.com/www/live/get_live_video?scid=' + str(scid)).json()
|
||||
status_code = response.get('data').get('info').get('status')
|
||||
status = '直播中' if status_code == 10 else '未开播'
|
||||
except:
|
||||
raise Exception('链接错误')
|
||||
return status
|
||||
res = self.s.get(self.rid).text
|
||||
play_url, status_code = re.findall(r'play_url:"(.*?)"[\s\S]*status:(\d+),', res)[0]
|
||||
if status_code == '10':
|
||||
return play_url
|
||||
else:
|
||||
raise Exception('未开播')
|
||||
except Exception:
|
||||
raise Exception('获取错误')
|
||||
|
||||
|
||||
def get_real_url(rid):
|
||||
|
22
youku.py
22
youku.py
@ -13,28 +13,32 @@ import json
|
||||
class YouKu:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
获取优酷轮播台的流媒体地址
|
||||
Args:
|
||||
rid: 直播间url中id=8019610,其中id即为房间号
|
||||
"""
|
||||
self.rid = rid
|
||||
self.s = requests.Session()
|
||||
|
||||
def get_real_url(self):
|
||||
try:
|
||||
tt = str(int(time.time() * 1000))
|
||||
data = json.dumps({'liveId': self.rid, 'app': 'Pc'}, separators=(',', ':'))
|
||||
url = 'https://acs.youku.com/h5/mtop.youku.live.com.livefullinfo/1.0/?appKey=24679788'
|
||||
s = requests.Session()
|
||||
cookies = s.get(url).cookies
|
||||
token = requests.utils.dict_from_cookiejar(cookies).get('_m_h5_tk')[0:32]
|
||||
sign = hashlib.md5((token + '&' + tt + '&' + '24679788' + '&' + data).encode('utf-8')).hexdigest()
|
||||
cookies = self.s.get(url).cookies
|
||||
token = cookies.get_dict().get('_m_h5_tk')[0:32]
|
||||
sign = hashlib.md5(f'{token}&{tt}&24679788&{data}'.encode('utf-8')).hexdigest()
|
||||
params = {
|
||||
't': tt,
|
||||
'sign': sign,
|
||||
'data': data
|
||||
}
|
||||
response = s.get(url, params=params).json()
|
||||
# name = response.get('data').get('data').get('name')
|
||||
response = self.s.get(url, params=params).json()
|
||||
streamname = response.get('data').get('data').get('stream')[0].get('streamName')
|
||||
real_url = 'http://lvo-live.youku.com/vod2live/{}_mp4hd2v3.m3u8?&expire=21600&psid=1&ups_ts={}&vkey='.format(
|
||||
streamname, int(time.time()))
|
||||
except:
|
||||
real_url = f'https://lvo-live.youku.com/vod2live/{streamname}_mp4hd2v3.m3u8?&expire=21600&psid=1&ups_ts=' \
|
||||
f'{int(time.time())}&vkey= '
|
||||
except Exception:
|
||||
raise Exception('请求错误')
|
||||
return real_url
|
||||
|
||||
|
@ -10,12 +10,12 @@ class YuanBoBo:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://zhibo.yuanbobo.com/' + str(self.rid)).text
|
||||
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
|
||||
stream_id = re.search(r"stream_id:\s+'(\d+)'", res)
|
||||
if stream_id:
|
||||
status = re.search(r"status:\s+'(\d)'", res).group(1)
|
||||
if status == '1':
|
||||
real_url = 'http://ks-hlslive.yuanbobo.com/live/{}/index.m3u8'.format(stream_id.group(1))
|
||||
real_url = f'https://tliveplay.yuanbobo.com/live/{stream_id.group(1)}.m3u8'
|
||||
return real_url
|
||||
else:
|
||||
raise Exception('未开播')
|
||||
|
10
yy.py
10
yy.py
@ -13,11 +13,11 @@ class YY:
|
||||
|
||||
def get_real_url(self):
|
||||
headers = {
|
||||
'referer': 'http://wap.yy.com/mobileweb/{rid}'.format(rid=self.rid),
|
||||
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko)'
|
||||
' Version/11.0 Mobile/15A372 Safari/604.1'
|
||||
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
|
||||
'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 '
|
||||
}
|
||||
room_url = 'http://interface.yy.com/hls/new/get/{rid}/{rid}/1200?source=wapyy&callback='.format(rid=self.rid)
|
||||
room_url = f'https://interface.yy.com/hls/new/get/{self.rid}/{self.rid}/1200?source=wapyy&callback='
|
||||
with requests.Session() as s:
|
||||
res = s.get(room_url, headers=headers)
|
||||
if res.status_code == 200:
|
||||
@ -26,7 +26,7 @@ class YY:
|
||||
xa = data['audio']
|
||||
xv = data['video']
|
||||
xv = re.sub(r'_0_\d+_0', '_0_0_0', xv)
|
||||
url = 'https://interface.yy.com/hls/get/stream/15013/{}/15013/{}?source=h5player&type=m3u8'.format(xv, xa)
|
||||
url = f'https://interface.yy.com/hls/get/stream/15013/{xv}/15013/{xa}?source=h5player&type=m3u8'
|
||||
res = s.get(url).json()
|
||||
real_url = res['hls']
|
||||
return real_url
|
||||
|
19
zhanqi.py
19
zhanqi.py
@ -2,6 +2,7 @@
|
||||
# 默认最高画质
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
@ -9,12 +10,18 @@ import requests
|
||||
class ZhanQi:
|
||||
|
||||
def __init__(self, rid):
|
||||
self.rid = rid
|
||||
"""
|
||||
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
|
||||
所以先判断一次后从网页源代码里获取数字直播间号
|
||||
Args:
|
||||
rid:直播间链接,从网页源码里获取真实数字rid
|
||||
"""
|
||||
self.s = requests.Session()
|
||||
res = self.s.get(rid).text
|
||||
self.rid = re.search(r'"code":"(\d+)"', res).group(1)
|
||||
|
||||
def get_real_url(self):
|
||||
|
||||
res = self.s.get('https://m.zhanqi.tv/api/static/v2.1/room/domain/{}.json'.format(self.rid))
|
||||
res = self.s.get(f'https://m.zhanqi.tv/api/static/v2.1/room/domain/{self.rid}.json')
|
||||
try:
|
||||
res = res.json()
|
||||
videoid = res['data']['videoId']
|
||||
@ -47,8 +54,7 @@ class ZhanQi:
|
||||
res = self.s.post('https://www.zhanqi.tv/api/public/burglar/chain', data=data, headers=headers).json()
|
||||
chain_key = res['data']['key']
|
||||
url = f'https://{cdn_host}/alhdl-cdn.zhanqi.tv/zqlive/{videoid}.flv?{chain_key}&playNum=68072487067' \
|
||||
f'&gId={gid}&ipFrom=1&clientIp=&fhost=h5&platform=128 '
|
||||
|
||||
f'&gId={gid}&ipFrom=1&clientIp=&fhost=h5&platform=128'
|
||||
return url
|
||||
else:
|
||||
raise Exception('No streaming')
|
||||
@ -64,5 +70,6 @@ def get_real_url(rid):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
r = input('输入战旗直播房间号:\n')
|
||||
# 直播间链接类似:https://www.zhanqi.tv/topic/owl 或 https://www.zhanqi.tv/152600919
|
||||
r = input('输入战旗直播间的链接:\n')
|
||||
print(get_real_url(r))
|
||||
|
Loading…
x
Reference in New Issue
Block a user