mirror of
https://github.com/wbt5/real-url.git
synced 2025-06-16 15:59:57 +08:00
fixed
This commit is contained in:
parent
7c891fe07c
commit
c1119deda9
2
173.py
2
173.py
@ -9,7 +9,7 @@ class YQS:
|
||||
self.rid = rid
|
||||
|
||||
def get_real_url(self):
|
||||
params = 'roomId={}&format=m3u8'.format(self.rid)
|
||||
params = 'roomId={}'.format(self.rid)
|
||||
with requests.Session() as s:
|
||||
res = s.post('http://www.173.com/room/getVieoUrl', params=params).json()
|
||||
data = res['data']
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 获取17直播的真实流媒体地址。
|
||||
# 获取17直播的真实流媒体地址,可能需要挂国外代理才行。
|
||||
# 17直播间链接形式:https://17.live/live/276480
|
||||
|
||||
import requests
|
||||
@ -8,9 +8,15 @@ class Live17:
|
||||
|
||||
def __init__(self, rid):
|
||||
self.rid = rid
|
||||
# 可能需要挂代理。
|
||||
# self.proxies = {
|
||||
# "http": "http://xxxx:1080",
|
||||
# "https": "http://xxxx:1080",
|
||||
# }
|
||||
|
||||
def get_real_url(self):
|
||||
try:
|
||||
# response = requests.get(url='https://api-dsa.17app.co/api/v1/lives/' + self.rid, proxies=self.proxies).json()
|
||||
response = requests.get(url='https://api-dsa.17app.co/api/v1/lives/' + self.rid).json()
|
||||
real_url_default = response.get('rtmpUrls')[0].get('url')
|
||||
real_url_modify = real_url_default.replace('global-pull-rtmp.17app.co', 'china-pull-rtmp-17.tigafocus.com')
|
||||
|
@ -15,7 +15,7 @@
|
||||
## 运行
|
||||
|
||||
1. 项目使用了很简单的 Python 代码,仅在 Python 3 环境运行测试。
|
||||
2. 具体所需模块请查看代码中的 import。
|
||||
2. 具体所需模块请查看 requirements.txt
|
||||
3. 获取斗鱼和爱奇艺的直播源,需 JavaScript 环境,可使用 node.js。爱奇艺直播里有个参数是加盐的 MD5,由仓库中的 iqiyi.js 生成。
|
||||
4. 每个平台的直播源和弹幕获取功能相互独立,以后再整合。弹幕食用:python main.py
|
||||
|
||||
@ -25,7 +25,9 @@
|
||||
|
||||
## 更新
|
||||
|
||||
### 2020.10.17:修复:西瓜直播、YY直播。
|
||||
### 2020.12.20:修复直播源:抖音、艺气山、花椒、快手、来疯、龙珠、PPS、人人直播、17live 可能需要挂代理。
|
||||
|
||||
2020.10.17:修复:西瓜直播、YY直播。
|
||||
|
||||
2020.09.26:更新:虎牙直播源;注释掉未完成的 YY 直播弹幕功能。
|
||||
|
||||
|
10
douyin.py
10
douyin.py
@ -1,7 +1,7 @@
|
||||
# 获取抖音直播的真实流媒体地址,默认最高画质。
|
||||
# 如果知道该直播间如“6779127643792280332”形式的room_id,则直接传入room_id。
|
||||
# 如果不知道room_id,可以使用手机上打开直播间后,选择“分享--复制链接”,传入如“https://v.douyin.com/qyRqMp/”形式的分享链接。
|
||||
|
||||
#
|
||||
import requests
|
||||
import re
|
||||
|
||||
@ -17,10 +17,10 @@ class DouYin:
|
||||
room_id = re.findall(r'(\d{19})', requests.get(url=self.rid).url)[0]
|
||||
else:
|
||||
room_id = self.rid
|
||||
room_url = 'https://webcast-hl.amemv.com/webcast/room/reflow/info/?room_id={}&live_id=1'.format(room_id)
|
||||
response = requests.get(url=room_url).json()
|
||||
hls_pull_url = response.get('data').get('room').get('stream_url').get('hls_pull_url')
|
||||
rtmp_pull_url = response.get('data').get('room').get('stream_url').get('rtmp_pull_url')
|
||||
room_url = 'https://webcast.amemv.com/webcast/reflow/{}'.format(room_id)
|
||||
response = requests.get(url=room_url).text
|
||||
rtmp_pull_url = re.search(r'"rtmp_pull_url":"(.*?flv)"', response).group(1)
|
||||
hls_pull_url = re.search(r'"hls_pull_url":"(.*?m3u8)"', response).group(1)
|
||||
real_url = [rtmp_pull_url, hls_pull_url]
|
||||
except:
|
||||
raise Exception('直播间不存在或未开播或参数错误')
|
||||
|
@ -8,12 +8,15 @@ class HuaJiao:
|
||||
|
||||
def __init__(self, rid):
|
||||
self.rid = rid
|
||||
self.headers = {
|
||||
'Referer': 'https://h.huajiao.com/l/index?liveid={}&qd=hu'.format(rid)
|
||||
}
|
||||
|
||||
def get_real_url(self):
|
||||
tt = str(time.time())
|
||||
try:
|
||||
room_url = 'https://h.huajiao.com/api/getFeedInfo?sid={tt}&liveid={rid}'.format(tt=tt, rid=self.rid)
|
||||
response = requests.get(url=room_url).json()
|
||||
response = requests.get(url=room_url, headers=self.headers).json()
|
||||
real_url = response.get('data').get('live').get('main')
|
||||
except:
|
||||
raise Exception('直播间不存在或未开播')
|
||||
|
@ -1,4 +1,6 @@
|
||||
# 获取快手直播的真实流媒体地址,默认输出最高画质
|
||||
# https://live.kuaishou.com/u/KPL704668133
|
||||
# 如获取失败,尝试修改 cookie 中的 did
|
||||
|
||||
import json
|
||||
import re
|
||||
@ -14,7 +16,7 @@ class KuaiShou:
|
||||
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',
|
||||
'cookie': 'did=web_'}
|
||||
'cookie': 'did=web_d563dca728d28b00336877723e0359ed'}
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://m.gifshow.com/fw/live/{}'.format(self.rid), headers=headers)
|
||||
livestream = re.search(r'liveStream":(.*),"obfuseData', res.text)
|
||||
@ -38,5 +40,6 @@ def get_real_url(rid):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
r = input('请输入快手直播房间地址:\n')
|
||||
# KPL704668133
|
||||
r = input('请输入快手直播房间ID:\n')
|
||||
print(get_real_url(r))
|
||||
|
@ -17,7 +17,7 @@ class LaiFeng:
|
||||
stream_name = re.findall(r"initAlias:'(.*)?'", response_main)[0]
|
||||
real_url = {}
|
||||
for stream_format in ['HttpFlv', 'Hls']:
|
||||
request_url = 'https://lapi.lcloud.laifeng.com/Play?AppId=101&StreamName={}&Action=Schedule&Version=2.0&Format={}'.format(stream_name, stream_format)
|
||||
request_url = 'https://lapi.lcloud.laifeng.com/Play?AppId=101&CallerVersion=2.0&StreamName={}&Action=Schedule&Version=2.0&Format={}'.format(stream_name, stream_format)
|
||||
response = requests.get(url=request_url).json()
|
||||
real_url[stream_format] = response.get(stream_format)[0].get('Url')
|
||||
except:
|
||||
|
@ -11,10 +11,10 @@ class LongZhu:
|
||||
|
||||
def get_real_url(self):
|
||||
try:
|
||||
response = requests.get('http://m.longzhu.com/' + str(self.rid)).text
|
||||
roomId = re.findall(r'roomId = (\d*);', response)[0]
|
||||
response = requests.get('http://livestream.longzhu.com/live/getlivePlayurl?roomId={}&hostPullType=2&isAdvanced=true&playUrlsType=1'.format(roomId)).json()
|
||||
real_url = response.get('playLines')[0].get('urls')[-1].get('securityUrl')
|
||||
response = requests.get('http://star.longzhu.com/' + str(self.rid)).text
|
||||
roomId = re.findall(r'roomid":(\d+)', response)[0]
|
||||
response = requests.get('http://livestream.longzhu.com/live/getlivePlayurl?roomId={}&utmSr=&platform=h5&device=ios'.format(roomId)).json()
|
||||
real_url = response.get('playLines')[0].get('urls')[0].get('securityUrl')
|
||||
except:
|
||||
raise Exception('直播间不存在或未开播')
|
||||
return real_url
|
||||
|
2
pps.py
2
pps.py
@ -15,7 +15,7 @@ class PPS:
|
||||
response = requests.get('http://m-x.pps.tv/room/' + str(self.rid)).text
|
||||
anchor_id = re.findall(r'anchor_id":(\d*),"online_uid', response)[0]
|
||||
tt = int(time.time() * 1000)
|
||||
url = 'http://api-live.iqiyi.com/stream/geth5?qd_tm={}&typeId=1&platform=7&vid=0&qd_vip=0&qd_uid={}&qd_ip=114.114.114.114&qd_vipres=0&qd_src=h5_xiu&qd_tvid=0&callback='.format(tt, anchor_id)
|
||||
url = 'http://m-x.pps.tv/api/stream/getH5?qd_tm={}&typeId=1&platform=7&vid=0&qd_vip=0&qd_uid={}&qd_ip=114.114.114.114&qd_vipres=0&qd_src=h5_xiu&qd_tvid=0&callback='.format(tt, anchor_id)
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Referer': 'http://m-x.pps.tv/'
|
||||
|
16
renren.py
16
renren.py
@ -18,14 +18,14 @@ class RenRen:
|
||||
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
|
||||
# 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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user