1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-08-04 01:12:48 +08:00

Compare commits

...

23 Commits

Author SHA1 Message Date
wbt5
38f1982eaa 新增19个直播平台 2020-07-31 19:45:43 +08:00
wbt5
cc76a3f975 新增棉花糖直播 2020-07-31 19:45:08 +08:00
wbt5
b5090adea9 新增九秀直播 2020-07-31 19:44:50 +08:00
wbt5
60875bb202 新增羚萌直播 2020-07-31 19:41:57 +08:00
wbt5
245081dca3 新增95秀 2020-07-31 19:41:40 +08:00
wbt5
e3bfbe5089 新增新浪疯播直播 2020-07-31 19:41:21 +08:00
wbt5
eb67046e6a 新增红人直播 2020-07-31 19:40:49 +08:00
wbt5
f8d31de046 新增艾米直播 2020-07-31 19:40:29 +08:00
wbt5
c5c0a25a30 新增京东直播 2020-07-31 19:40:14 +08:00
wbt5
30283363f8 新增KK直播 2020-07-31 19:40:01 +08:00
wbt5
d126f67d15 新增酷我聚星直播 2020-07-31 19:39:41 +08:00
wbt5
0aa9072f18 新增乐嗨直播 2020-07-31 19:39:16 +08:00
wbt5
76269decd9 新增企鹅体育 2020-07-31 19:38:56 +08:00
wbt5
30ca940ea7 新增人人直播 2020-07-31 19:38:34 +08:00
wbt5
64e658f0cb 新增秀色直播 2020-07-31 19:38:22 +08:00
wbt5
a8f088b870 新增星光直播 2020-07-31 19:38:05 +08:00
wbt5
da9f6c3506 新增小米直播 2020-07-31 19:37:43 +08:00
wbt5
f6f9782775 新增我秀直播 2020-07-31 19:37:14 +08:00
wbt5
ae464ee70b 新增迅雷直播 2020-07-31 19:36:46 +08:00
wbt5
6fa8047137 优化优酷直播 2020-07-31 19:36:31 +08:00
wbt5
fe32942cdb 新增热猫直播 2020-07-31 19:36:01 +08:00
wbt5
63c21e9e3f 优化YY直播 2020-07-31 19:35:27 +08:00
wbt5
73611d4d43 优化战旗直播 2020-07-31 19:34:55 +08:00
23 changed files with 641 additions and 57 deletions

22
2cq.py Normal file
View File

@ -0,0 +1,22 @@
# 棉花糖直播https://www.2cq.com/rank
import requests
def mht(rid):
with requests.Session() as s:
res = s.get('https://www.2cq.com/proxy/room/room/info?roomId={}&appId=1004'.format(rid))
res = res.json()
if res['status'] == 1:
result = res['result']
if result['liveState'] == 1:
real_url = result['pullUrl']
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间可能不存在')
if __name__ == '__main__':
r = input('输入棉花糖直播房间号:\n')
print(mht(r))

43
51lm.py Normal file
View File

@ -0,0 +1,43 @@
# 羚萌直播https://live.51lm.tv/programs/Hot
from urllib.parse import urlencode
import requests
import time
import hashlib
def lm(rid):
roominfo = {'programId': rid}
def g(d):
return hashlib.md5((d + '#' + urlencode(roominfo) + '#Ogvbm2ZiKE').encode('utf-8')).hexdigest()
lminfo = {
'h': int(time.time()) * 1000,
'i': -246397986,
'o': 'iphone',
's': 'G_c17a64eff3f144a1a48d9f02e8d981c2',
't': 'H',
'v': '4.20.43',
'w': 'a710244508d3cc14f50d24e9fecc496a'
}
u = g(urlencode(lminfo))
lminfo = 'G=' + u + '&' + urlencode(lminfo)
with requests.Session() as s:
res = s.post('https://www.51lm.tv/live/room/info/basic', json=roominfo, headers={'lminfo': lminfo}).json()
code = res['code']
if code == 200:
status = res['data']['isLiving']
if status == 'True':
real_url = res['data']['playUrl']
return real_url
else:
raise Exception('未开播')
elif code == -1:
raise Exception('输入错误')
elif code == 1201:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入羚萌直播房间号:\n')
print(lm(r))

23
95xiu.py Normal file
View File

@ -0,0 +1,23 @@
# 95秀http://www.95.cn/
import requests
import re
def jwxiu(rid):
with requests.Session() as s:
res = s.get('http://www.95.cn/{}.html'.format(rid)).text
try:
uid = re.search(r'"uid":(\d+),', res).group(1)
status = re.search(r'"is_offline":"(\d)"', res).group(1)
except AttributeError:
raise Exception('没有找到直播间')
if status == '0':
real_url = 'http://play.95xiu.com/app/{}.flv'.format(uid)
return real_url
else:
raise Exception('未开播')
if __name__ == '__main__':
r = input('输入95秀房间号\n')
print(jwxiu(r))

26
9xiu.py Normal file
View File

@ -0,0 +1,26 @@
# 九秀直播https://www.9xiu.com/other/classify?tag=all&index=all
import requests
def j_xiu(rid):
with requests.Session() as s:
url = 'https://h5.9xiu.com/room/live/enterRoom?rid=' + str(rid)
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'
}
res = s.get(url, headers=headers).json()
if res['code'] == 200:
status = res['data']['status']
if status == 0:
raise Exception('未开播')
elif status == 1:
live_url = res['data']['live_url']
return live_url
else:
raise Exception('直播间可能不存在')
if __name__ == '__main__':
r = input('输入九秀直播房间号:\n')
print(j_xiu(r))

View File

@ -6,7 +6,7 @@
目前已实现:
**27** 个直播平台的直播源获取:斗鱼直播、虎牙直播、哔哩哔哩直播、战旗直播、网易 CC 直播、火猫直播、企鹅电竞、YY 直播、一直播、快手直播、花椒直播、映客直播、西瓜直播、触手直播、NOW 直播、抖音直播爱奇艺直播、酷狗直播、龙珠直播、PPS 奇秀直播、六间房、17 直播、来疯直播、优酷轮播台、网易 LOOK 直播、千帆直播、陌陌直播
**46** 个直播平台的直播源获取:斗鱼直播、虎牙直播、哔哩哔哩直播、战旗直播、网易 CC 直播、火猫直播、企鹅电竞、YY 直播、一直播、快手直播、花椒直播、映客直播、西瓜直播、触手直播、NOW 直播、抖音直播爱奇艺直播、酷狗直播、龙珠直播、PPS 奇秀直播、六间房、17 直播、来疯直播、优酷轮播台、网易 LOOK 直播、千帆直播、陌陌直播、小米直播、迅雷直播、京东直播、企鹅体育、人人直播、棉花糖直播、九秀直播、羚萌直播、95秀、新浪疯播、红人直播、艾米直播、KK直播、酷我聚星、乐嗨直播、秀色直播、星光直播、我秀直播、热猫直播
**16** 个直播平台的弹幕获取:斗鱼直播、虎牙直播、哔哩哔哩直播、快手直播、火猫直播、企鹅电竞、花椒直播、映客直播、网易 CC 直播、酷狗直播、龙珠直播、PPS 奇秀、搜狐千帆、战旗直播、来疯直播、网易 LOOK 直播。
@ -23,7 +23,9 @@
## 更新
### 2020.07.25:新增网易 LOOK 直播弹幕获取;修复斗鱼直播源;新增陌陌直播源。
### 2020.07.31:新增 19 个直播平台详见上面说明更新YY直播现在可以获取最高画质优化战旗直播、优酷直播代码
2020.07.25:新增网易 LOOK 直播弹幕获取;修复斗鱼直播源;新增陌陌直播源。
2020.07.19:新增来疯直播弹幕获取

38
fengbolive.py Normal file
View File

@ -0,0 +1,38 @@
# 新浪疯播直播http://www.fengbolive.com/list?type=hot
# 链接样式http://www.fengbolive.com/live/88057518
from Crypto.Cipher import AES
from urllib.parse import unquote
import base64
import json
import requests
def fengbo(rid):
with requests.Session() as s:
res = s.get('https://external.fengbolive.com/cgi-bin/get_anchor_info_proxy.fcgi?anchorid=' + str(rid)).json()
if res['ret'] == 1:
info = res['info']
info = unquote(info, 'utf-8')
# 开始AES解密
def pad(t):
return t + (16 - len(t) % 16) * b'\x00'
key = iv = 'abcdefghqwertyui'.encode('utf8')
cipher = AES.new(key, AES.MODE_CBC, iv)
info = info.encode('utf8')
info = pad(info)
result = cipher.decrypt(base64.decodebytes(info)).rstrip(b'\0')
result = json.loads(result.decode('utf-8'))
url = result['url']
url = url.replace('hdl', 'hls')
url = url.replace('.flv', '/playlist.m3u8')
return url
else:
raise Exception('房间号错误')
if __name__ == '__main__':
r = input('输入疯播直播房间号:\n')
print(fengbo(r))

43
hongle.py Normal file
View File

@ -0,0 +1,43 @@
# 红人直播https://www.hongle.tv/
from urllib.parse import urlencode
import requests
import time
import hashlib
def hongle(rid):
url = 'https://service.hongle.tv/v2/roomw/media'
accesstoken = 'YeOucg9SmlbeeicDSN9k0efa4JaecMNbQd7eTQDNQRRmqUHnA%2Bwq4g%3D%3D'
params = {
'_st1': int(time.time() * 1000),
'accessToken': accesstoken,
'of': 1,
'showid': rid,
'tku': 44623062,
}
data = urlencode(params) + 'yuj1ah5o'
_ajaxData1 = hashlib.md5(data.encode('utf-8')).hexdigest()
params['_ajaxData1'] = _ajaxData1
params['accessToken'] = 'YeOucg9SmlbeeicDSN9k0efa4JaecMNbQd7eTQDNQRRmqUHnA+wq4g=='
with requests.Session() as s:
res = s.get(url, params=params)
if res.status_code == 200:
res = res.json()
statuscode = res['status']['statuscode']
if statuscode == '0':
if res['data']['live_status'] == '1':
real_url = res['data']['media_url_web']
real_url = real_url.replace('http', 'https')
real_url = real_url.replace('__', '&')
return real_url
else:
raise Exception('未开播')
else:
raise Exception('房间不存在')
else:
raise Exception('参数错误')
if __name__ == '__main__':
r = input('输入红人直播房间号:\n')
print(hongle(r))

23
imifun.py Normal file
View File

@ -0,0 +1,23 @@
# 艾米直播https://www.imifun.com/
import requests
import re
def imifun(rid):
with requests.Session() as s:
res = s.get('https://www.imifun.com/' + str(rid)).text
roomid = re.search(r"roomId:\s'([\w-]+)'", res)
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))
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入艾米直播房间号:\n')
print(imifun(r))

31
jd.py Normal file
View File

@ -0,0 +1,31 @@
# 京东直播https://h5.m.jd.com/dev/3pbY8ZuCx4ML99uttZKLHC2QcAMn/live.html?id=1807004&position=0
import requests
import json
def jd(rid):
url = 'https://api.m.jd.com/client.action'
params = {
'functionId': 'liveDetail',
'body': json.dumps({'id': rid, 'videoType': 1}, separators=(',', ':')),
'client': 'wh5'
}
with requests.Session() as s:
res = s.get(url, params=params).json()
data = res.get('data', 0)
if data:
status = data['status']
if status == 1:
real_url = data['h5Pull']
return real_url
else:
print('未开播')
real_url = '回放:' + data.get('playBack').get('videoUrl', 0)
return real_url
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入京东直播间id\n')
print(jd(r))

27
kk.py Normal file
View File

@ -0,0 +1,27 @@
# KK直播http://www.kktv5.com/
import requests
def kk(rid):
url = 'https://sapi.kktv1.com/meShow/entrance?parameter={}'
parameter = {'FuncTag': 10005043, 'userId': '{}'.format(rid), 'platform': 1, 'a': 1, 'c': 100101}
with requests.Session() as s:
res = 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()
real_url = res['liveStream']
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入KK直播房间号\n')
print(kk(r))

22
kuwo.py Normal file
View File

@ -0,0 +1,22 @@
# 酷我聚星直播http://jx.kuwo.cn/
import requests
def kuwo(rid):
with requests.Session() as s:
res = s.get('https://zhiboserver.kuwo.cn/proxy.p?src=h5&cmd=enterroom&rid={}&videotype=1&auto=1'.format(rid))
res = res.json()
try:
livestatus = res['room']['livestatus']
except KeyError:
raise Exception('房间号错误')
if livestatus == 2:
real_url = res['live']['url']
return real_url
else:
raise Exception('未开播')
if __name__ == '__main__':
r = input('输入酷我聚星直播房间号:\n')
print(kuwo(r))

40
lehai.py Normal file
View File

@ -0,0 +1,40 @@
# 乐嗨直播https://www.lehaitv.com/
from urllib.parse import urlencode
from urllib.parse import unquote
import requests
import time
import hashlib
def lehai(rid):
url = 'https://service.lehaitv.com/v2/room/{}/enter'.format(rid)
params = {
'_st1': int(time.time() * 1e3),
'accessToken': 's7FUbTJ%2BjILrR7kicJUg8qr025ZVjd07DAnUQd8c7g%2Fo4OH9pdSX6w%3D%3D',
'tku': 3000006,
}
data = urlencode(params) + '1eha12h5'
_ajaxData1 = hashlib.md5(data.encode('utf-8')).hexdigest()
params['_ajaxData1'] = _ajaxData1
params['accessToken'] = unquote(params['accessToken'])
with requests.Session() as s:
res = s.get(url, params=params)
if res.status_code == 200:
res = res.json()
statuscode = res['status']['statuscode']
if statuscode == '0':
if res['data']['live_status'] == '1':
anchor, = res['data']['anchor']
real_url = anchor['media_url']
return real_url
else:
raise Exception('未开播')
else:
raise Exception('房间不存在 或 权限检查错误')
else:
raise Exception('请求错误')
if __name__ == '__main__':
r = input('输入乐嗨直播房间号:\n')
print(lehai(r))

22
qie.py Normal file
View File

@ -0,0 +1,22 @@
# 企鹅体育https://live.qq.com/directory/all
import requests
import re
def qie(rid):
with requests.Session() as s:
res = s.get('https://m.live.qq.com/' + str(rid))
show_status = re.search(r'"show_status":"(\d)"', res.text)
if show_status:
if show_status.group(1) == '1':
hls_url = re.search(r'"hls_url":"(.*)","use_p2p"', res.text).group(1)
return hls_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入企鹅体育直播间号:\n')
print(qie(r))

33
renren.py Normal file
View File

@ -0,0 +1,33 @@
# 人人直播http://zhibo.renren.com/
import requests
import re
import hashlib
def renren(rid):
with requests.Session() as s:
res = s.get('http://activity.renren.com/liveroom/' + str(rid))
livestate = re.search(r'"liveState":(\d)', res.text)
if livestate:
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 t
elif livestate.group(1) == '1':
return '回放:' + s
except IndexError:
raise Exception('解析错误')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入人人直播房间号:\n')
print(renren(r))

49
showself.py Normal file
View File

@ -0,0 +1,49 @@
# 秀色直播https://www.showself.com/
from urllib.parse import urlencode
import requests
import time
import hashlib
def showself(rid):
with requests.Session() as s:
res = s.get('https://service.showself.com/v2/custuser/visitor').json()
uid = res['data']['uid']
accesstoken = sessionid = res['data']['sessionid']
params = {
'accessToken': accesstoken,
'tku': uid,
'_st1': int(time.time() * 1000)
}
payload = {
'groupid': '999',
'roomid': rid,
'sessionid': sessionid,
'sessionId': sessionid
}
data = dict(params, **payload)
data = 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(rid, urlencode(params))
with requests.Session() as s:
res = s.post(url, json=payload)
if res.status_code == 200:
res = res.json()
statuscode = res['status']['statuscode']
if statuscode == '0':
if res['data']['roomInfo']['live_status'] == '1':
anchor, = res['data']['roomInfo']['anchor']
real_url = anchor['media_url']
return real_url
else:
raise Exception('未开播')
else:
raise Exception('房间不存在')
else:
raise Exception('参数错误')
if __name__ == '__main__':
r = input('输入秀色直播房间号:\n')
print(showself(r))

23
tuho.py Normal file
View File

@ -0,0 +1,23 @@
# 星光直播https://www.tuho.tv/28545037
import requests
import re
def tuho(rid):
with requests.Session() as s:
res = s.get('https://www.tuho.tv/' + str(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)
if status == 'true':
real_url = flv.group(1).replace('\\', '')
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入星光直播房间号:\n')
print(tuho(r))

19
wali.py Normal file
View File

@ -0,0 +1,19 @@
# 小米直播https://live.wali.com/fe
import requests
def wali(rid):
zuid = rid.split('_')[0]
with requests.Session() as s:
res = s.get('https://s.zb.mi.com/get_liveinfo?lid={}&zuid={}'.format(rid, zuid)).json()
status = res['data']['status']
if status == 1:
flv = res['data']['video']['flv']
return flv.replace('http', 'https')
else:
raise Exception('直播间不存在或未开播')
if __name__ == '__main__':
r = input('输入小米直播房间号:\n')
print(wali(r))

27
woxiu.py Normal file
View File

@ -0,0 +1,27 @@
# 我秀直播https://www.woxiu.com/
import requests
def woxiu(rid):
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'
}
url = 'https://m.woxiu.com/index.php?action=M/Live&do=LiveInfo&room_id={}'.format(rid)
with requests.Session() as s:
res = s.get(url, headers=headers)
try:
res = res.json()
except:
raise Exception('直播间不存在')
status = res['online']
if status:
live_stream = res['live_stream']
return live_stream
else:
raise Exception('未开播')
if __name__ == '__main__':
r = input('输入我秀直播房间号:\n')
print(woxiu(r))

41
xunlei.py Normal file
View File

@ -0,0 +1,41 @@
# 迅雷直播https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
def xunlei(rid):
url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'cookie': 'appid=1002'
}
_t = int(time.time() * 1000)
u = '1002'
f = '&*%$7987321GKwq'
params = {
'_t': _t,
'a': 'play',
'c': 'room',
'hid': 'h5-e70560ea31cc17099395c15595bdcaa1',
'uuid': rid,
}
data = urlencode(params)
p = hashlib.md5((u + data + f).encode('utf-8')).hexdigest()
params['sign'] = p
with requests.Session() as s:
res = s.get(url, params=params, headers=headers).json()
if res['result'] == 0:
play_status = res['data']['play_status']
if play_status == 1:
real_url = res['data']['data']['stream_pull_https']
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间可能不存在')
if __name__ == '__main__':
r = input('输入迅雷直播房间号:\n')
print(xunlei(r))

View File

@ -1,18 +1,18 @@
# 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目轮播一些经典电影电视剧个人感觉要比其他直播平台影视区的画质要好而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接“https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目轮播一些经典电影电视剧个人感觉要比其他直播平台影视区的画质要好
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib
import json
def get_real_url(liveId):
def youku(liveid):
try:
tt = str(int(time.time()*1000))
data = json.dumps({"liveId":liveId,"app":"Pc"}, separators=(',', ':'))
tt = str(int(time.time() * 1000))
data = json.dumps({'liveId': liveid, '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
@ -24,16 +24,15 @@ def get_real_url(liveId):
'data': data
}
response = s.get(url, params=params).json()
name = response.get('data').get('data').get('name')
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()))
# name = response.get('data').get('data').get('name')
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:
name = real_url = '请求错误'
return name, real_url
real_url = '请求错误'
return real_url
liveId = input('请输入优酷轮播台liveId\n')
real_url = get_real_url(liveId)
print('该直播间地址为:')
print(real_url[0])
print(real_url[1])
if __name__ == '__main__':
r = input('输入优酷轮播台liveId\n')
print(youku(r))

23
yuanbobo.py Normal file
View File

@ -0,0 +1,23 @@
# 热猫直播https://zhibo.yuanbobo.com/
import requests
import re
def yuanbobo(rid):
with requests.Session() as s:
res = s.get('https://zhibo.yuanbobo.com/' + str(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))
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
if __name__ == '__main__':
r = input('输入热猫直播房间号:\n')
print(yuanbobo(r))

45
yy.py
View File

@ -1,28 +1,35 @@
# 获取YY直播的真实流媒体地址。
# 默认画质为高清1280*720
# 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
def get_real_url(rid):
room_url = 'http://interface.yy.com/hls/new/get/{rid}/{rid}/1200?source=wapyy&callback=jsonp3'.format(rid=rid)
def yy(rid):
headers = {
'referer': 'http://wap.yy.com/mobileweb/{rid}'.format(rid=rid),
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36'
}
try:
response = requests.get(url=room_url, headers=headers).text
json_data = json.loads(re.findall(r'\(([\W\w]*)\)', response)[0])
real_url = json_data.get('hls', 0)
if not real_url:real_url='未开播或直播间不存在'
except:
real_url = '请求错误或直播间不存在'
return real_url
'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'
}
room_url = 'http://interface.yy.com/hls/new/get/{rid}/{rid}/1200?source=wapyy&callback='.format(rid=rid)
with requests.Session() as s:
res = s.get(room_url, headers=headers)
if res.status_code == 200:
data = json.loads(res.text[1:-1])
if data.get('hls', 0):
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)
res = s.get(url).json()
real_url = res['hls']
return real_url
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
rid = input('请输入YY直播房间号\n')
real_url = get_real_url(rid)
print('该直播间源地址为:\n' + real_url)
if __name__ == '__main__':
r = input('输入YY直播房间号\n')
print(yy(r))

View File

@ -1,24 +1,25 @@
# 获取战旗直播战旗TV的真实流媒体地址。
# 默认画质为超清
# 获取战旗直播战旗TV的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import requests
def get_real_url(rid):
room_url = 'https://m.zhanqi.tv/api/static/v2.1/room/domain/' + str(rid) + '.json'
try:
response = requests.get(url=room_url).json()
videoId = response.get('data').get('videoId')
if videoId:
real_url = 'https://dlhdl-cdn.zhanqi.tv/zqlive/' + str(videoId) + '.flv'
else:
real_url = '未开播'
except:
real_url = '直播间不存在'
return real_url
def zhanqi(rid):
with requests.Session() as s:
res = s.get('https://m.zhanqi.tv/api/static/v2.1/room/domain/{}.json'.format(rid))
try:
res = res.json()
videoid = res['data']['videoId']
status = res['data']['status']
if status == '4':
url = 'https://dlhdl-cdn.zhanqi.tv/zqlive/{}.flv?get_url=1'.format(videoid)
real_url = s.get(url).text
else:
real_url = '未开播'
except:
real_url = '直播间不存在'
return real_url
rid = input('请输入战旗直播房间号:\n')
real_url = get_real_url(rid)
print('该直播间源地址为:\n' + real_url)
if __name__ == '__main__':
r = input('输入战旗直播房间号:\n')
print(zhanqi(r))