mirror of
https://github.com/wbt5/real-url.git
synced 2025-08-05 01:41:32 +08:00
Compare commits
No commits in common. "c1119deda9e1093fc035b81d1bc340c359101c9b" and "da727ccf7776e80deb7ffaf17181ea15f726aeab" have entirely different histories.
c1119deda9
...
da727ccf77
125
.gitignore
vendored
125
.gitignore
vendored
@ -1,124 +1 @@
|
|||||||
# Byte-compiled / optimized / DLL files
|
*/__pycache__/
|
||||||
__pycache__/
|
|
||||||
.idea/*
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# C extensions
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Distribution / packaging
|
|
||||||
.Python
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
pip-wheel-metadata/
|
|
||||||
share/python-wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
MANIFEST
|
|
||||||
|
|
||||||
# PyInstaller
|
|
||||||
# Usually these files are written by a python script from a template
|
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
|
||||||
pip-log.txt
|
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.nox/
|
|
||||||
.coverage
|
|
||||||
.coverage.*
|
|
||||||
.cache
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
*.cover
|
|
||||||
.hypothesis/
|
|
||||||
.pytest_cache/
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
*.mo
|
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Django stuff:
|
|
||||||
*.log
|
|
||||||
local_settings.py
|
|
||||||
db.sqlite3
|
|
||||||
|
|
||||||
# Flask stuff:
|
|
||||||
instance/
|
|
||||||
.webassets-cache
|
|
||||||
|
|
||||||
# Scrapy stuff:
|
|
||||||
.scrapy
|
|
||||||
|
|
||||||
# Sphinx documentation
|
|
||||||
docs/_build/
|
|
||||||
|
|
||||||
# PyBuilder
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Jupyter Notebook
|
|
||||||
.ipynb_checkpoints
|
|
||||||
|
|
||||||
# IPython
|
|
||||||
profile_default/
|
|
||||||
ipython_config.py
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
.python-version
|
|
||||||
|
|
||||||
# pipenv
|
|
||||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
||||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
||||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
||||||
# install all needed dependencies.
|
|
||||||
#Pipfile.lock
|
|
||||||
|
|
||||||
# celery beat schedule file
|
|
||||||
celerybeat-schedule
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# Spyder project settings
|
|
||||||
.spyderproject
|
|
||||||
.spyproject
|
|
||||||
|
|
||||||
# Rope project settings
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# mkdocs documentation
|
|
||||||
/site
|
|
||||||
|
|
||||||
# mypy
|
|
||||||
.mypy_cache/
|
|
||||||
.dmypy.json
|
|
||||||
dmypy.json
|
|
||||||
|
|
||||||
# Pyre type checker
|
|
||||||
.pyre/
|
|
||||||
|
2
173.py
2
173.py
@ -9,7 +9,7 @@ class YQS:
|
|||||||
self.rid = rid
|
self.rid = rid
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
params = 'roomId={}'.format(self.rid)
|
params = 'roomId={}&format=m3u8'.format(self.rid)
|
||||||
with requests.Session() as s:
|
with requests.Session() as s:
|
||||||
res = s.post('http://www.173.com/room/getVieoUrl', params=params).json()
|
res = s.post('http://www.173.com/room/getVieoUrl', params=params).json()
|
||||||
data = res['data']
|
data = res['data']
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# 获取17直播的真实流媒体地址,可能需要挂国外代理才行。
|
# 获取17直播的真实流媒体地址。
|
||||||
# 17直播间链接形式:https://17.live/live/276480
|
# 17直播间链接形式:https://17.live/live/276480
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -8,15 +8,9 @@ class Live17:
|
|||||||
|
|
||||||
def __init__(self, rid):
|
def __init__(self, rid):
|
||||||
self.rid = rid
|
self.rid = rid
|
||||||
# 可能需要挂代理。
|
|
||||||
# self.proxies = {
|
|
||||||
# "http": "http://xxxx:1080",
|
|
||||||
# "https": "http://xxxx:1080",
|
|
||||||
# }
|
|
||||||
|
|
||||||
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()
|
|
||||||
response = requests.get(url='https://api-dsa.17app.co/api/v1/lives/' + self.rid).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_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')
|
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 环境运行测试。
|
1. 项目使用了很简单的 Python 代码,仅在 Python 3 环境运行测试。
|
||||||
2. 具体所需模块请查看 requirements.txt
|
2. 具体所需模块请查看代码中的 import。
|
||||||
3. 获取斗鱼和爱奇艺的直播源,需 JavaScript 环境,可使用 node.js。爱奇艺直播里有个参数是加盐的 MD5,由仓库中的 iqiyi.js 生成。
|
3. 获取斗鱼和爱奇艺的直播源,需 JavaScript 环境,可使用 node.js。爱奇艺直播里有个参数是加盐的 MD5,由仓库中的 iqiyi.js 生成。
|
||||||
4. 每个平台的直播源和弹幕获取功能相互独立,以后再整合。弹幕食用:python main.py
|
4. 每个平台的直播源和弹幕获取功能相互独立,以后再整合。弹幕食用:python main.py
|
||||||
|
|
||||||
@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
## 更新
|
## 更新
|
||||||
|
|
||||||
### 2020.12.20:修复直播源:抖音、艺气山、花椒、快手、来疯、龙珠、PPS、人人直播、17live 可能需要挂代理。
|
### 2020.10.17:修复:西瓜直播、YY直播。
|
||||||
|
|
||||||
2020.10.17:修复:西瓜直播、YY直播。
|
|
||||||
|
|
||||||
2020.09.26:更新:虎牙直播源;注释掉未完成的 YY 直播弹幕功能。
|
2020.09.26:更新:虎牙直播源;注释掉未完成的 YY 直播弹幕功能。
|
||||||
|
|
||||||
|
10
douyin.py
10
douyin.py
@ -1,7 +1,7 @@
|
|||||||
# 获取抖音直播的真实流媒体地址,默认最高画质。
|
# 获取抖音直播的真实流媒体地址,默认最高画质。
|
||||||
# 如果知道该直播间如“6779127643792280332”形式的room_id,则直接传入room_id。
|
# 如果知道该直播间如“6779127643792280332”形式的room_id,则直接传入room_id。
|
||||||
# 如果不知道room_id,可以使用手机上打开直播间后,选择“分享--复制链接”,传入如“https://v.douyin.com/qyRqMp/”形式的分享链接。
|
# 如果不知道room_id,可以使用手机上打开直播间后,选择“分享--复制链接”,传入如“https://v.douyin.com/qyRqMp/”形式的分享链接。
|
||||||
#
|
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -17,10 +17,10 @@ class DouYin:
|
|||||||
room_id = re.findall(r'(\d{19})', requests.get(url=self.rid).url)[0]
|
room_id = re.findall(r'(\d{19})', requests.get(url=self.rid).url)[0]
|
||||||
else:
|
else:
|
||||||
room_id = self.rid
|
room_id = self.rid
|
||||||
room_url = 'https://webcast.amemv.com/webcast/reflow/{}'.format(room_id)
|
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).text
|
response = requests.get(url=room_url).json()
|
||||||
rtmp_pull_url = re.search(r'"rtmp_pull_url":"(.*?flv)"', response).group(1)
|
hls_pull_url = response.get('data').get('room').get('stream_url').get('hls_pull_url')
|
||||||
hls_pull_url = re.search(r'"hls_pull_url":"(.*?m3u8)"', response).group(1)
|
rtmp_pull_url = response.get('data').get('room').get('stream_url').get('rtmp_pull_url')
|
||||||
real_url = [rtmp_pull_url, hls_pull_url]
|
real_url = [rtmp_pull_url, hls_pull_url]
|
||||||
except:
|
except:
|
||||||
raise Exception('直播间不存在或未开播或参数错误')
|
raise Exception('直播间不存在或未开播或参数错误')
|
||||||
|
@ -8,15 +8,12 @@ class HuaJiao:
|
|||||||
|
|
||||||
def __init__(self, rid):
|
def __init__(self, rid):
|
||||||
self.rid = rid
|
self.rid = rid
|
||||||
self.headers = {
|
|
||||||
'Referer': 'https://h.huajiao.com/l/index?liveid={}&qd=hu'.format(rid)
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
tt = str(time.time())
|
tt = str(time.time())
|
||||||
try:
|
try:
|
||||||
room_url = 'https://h.huajiao.com/api/getFeedInfo?sid={tt}&liveid={rid}'.format(tt=tt, rid=self.rid)
|
room_url = 'https://h.huajiao.com/api/getFeedInfo?sid={tt}&liveid={rid}'.format(tt=tt, rid=self.rid)
|
||||||
response = requests.get(url=room_url, headers=self.headers).json()
|
response = requests.get(url=room_url).json()
|
||||||
real_url = response.get('data').get('live').get('main')
|
real_url = response.get('data').get('live').get('main')
|
||||||
except:
|
except:
|
||||||
raise Exception('直播间不存在或未开播')
|
raise Exception('直播间不存在或未开播')
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# 获取快手直播的真实流媒体地址,默认输出最高画质
|
# 获取快手直播的真实流媒体地址,默认输出最高画质
|
||||||
# https://live.kuaishou.com/u/KPL704668133
|
|
||||||
# 如获取失败,尝试修改 cookie 中的 did
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
@ -16,7 +14,7 @@ class KuaiShou:
|
|||||||
headers = {
|
headers = {
|
||||||
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 '
|
'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',
|
'(KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
'cookie': 'did=web_d563dca728d28b00336877723e0359ed'}
|
'cookie': 'did=web_'}
|
||||||
with requests.Session() as s:
|
with requests.Session() as s:
|
||||||
res = s.get('https://m.gifshow.com/fw/live/{}'.format(self.rid), headers=headers)
|
res = s.get('https://m.gifshow.com/fw/live/{}'.format(self.rid), headers=headers)
|
||||||
livestream = re.search(r'liveStream":(.*),"obfuseData', res.text)
|
livestream = re.search(r'liveStream":(.*),"obfuseData', res.text)
|
||||||
@ -40,6 +38,5 @@ def get_real_url(rid):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# KPL704668133
|
r = input('请输入快手直播房间地址:\n')
|
||||||
r = input('请输入快手直播房间ID:\n')
|
|
||||||
print(get_real_url(r))
|
print(get_real_url(r))
|
||||||
|
@ -17,7 +17,7 @@ class LaiFeng:
|
|||||||
stream_name = re.findall(r"initAlias:'(.*)?'", response_main)[0]
|
stream_name = re.findall(r"initAlias:'(.*)?'", response_main)[0]
|
||||||
real_url = {}
|
real_url = {}
|
||||||
for stream_format in ['HttpFlv', 'Hls']:
|
for stream_format in ['HttpFlv', 'Hls']:
|
||||||
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)
|
request_url = 'https://lapi.lcloud.laifeng.com/Play?AppId=101&StreamName={}&Action=Schedule&Version=2.0&Format={}'.format(stream_name, stream_format)
|
||||||
response = requests.get(url=request_url).json()
|
response = requests.get(url=request_url).json()
|
||||||
real_url[stream_format] = response.get(stream_format)[0].get('Url')
|
real_url[stream_format] = response.get(stream_format)[0].get('Url')
|
||||||
except:
|
except:
|
||||||
|
@ -11,10 +11,10 @@ class LongZhu:
|
|||||||
|
|
||||||
def get_real_url(self):
|
def get_real_url(self):
|
||||||
try:
|
try:
|
||||||
response = requests.get('http://star.longzhu.com/' + str(self.rid)).text
|
response = requests.get('http://m.longzhu.com/' + str(self.rid)).text
|
||||||
roomId = re.findall(r'roomid":(\d+)', response)[0]
|
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()
|
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')[0].get('securityUrl')
|
real_url = response.get('playLines')[0].get('urls')[-1].get('securityUrl')
|
||||||
except:
|
except:
|
||||||
raise Exception('直播间不存在或未开播')
|
raise Exception('直播间不存在或未开播')
|
||||||
return real_url
|
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
|
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]
|
anchor_id = re.findall(r'anchor_id":(\d*),"online_uid', response)[0]
|
||||||
tt = int(time.time() * 1000)
|
tt = int(time.time() * 1000)
|
||||||
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)
|
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)
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Referer': 'http://m-x.pps.tv/'
|
'Referer': 'http://m-x.pps.tv/'
|
||||||
|
16
renren.py
16
renren.py
@ -18,14 +18,14 @@ class RenRen:
|
|||||||
try:
|
try:
|
||||||
s = re.search(r'"playUrl":"([\s\S]*?)"', res.text).group(1)
|
s = re.search(r'"playUrl":"([\s\S]*?)"', res.text).group(1)
|
||||||
if livestate.group(1) == '0':
|
if livestate.group(1) == '0':
|
||||||
# accesskey = re.search(r'accesskey=(\w+)', s).group(1)
|
accesskey = re.search(r'accesskey=(\w+)', s).group(1)
|
||||||
# expire = re.search(r'expire=(\d+)', s).group(1)
|
expire = re.search(r'expire=(\d+)', s).group(1)
|
||||||
# live = re.search(r'(/live/\d+)', s).group(1)
|
live = re.search(r'(/live/\d+)', s).group(1)
|
||||||
# c = accesskey + expire + live
|
c = accesskey + expire + live
|
||||||
# key = hashlib.md5(c.encode('utf-8')).hexdigest()
|
key = hashlib.md5(c.encode('utf-8')).hexdigest()
|
||||||
# e = s.split('?')[0].split('/')[4]
|
e = s.split('?')[0].split('/')[4]
|
||||||
# t = 'http://ksy-hls.renren.com/live/' + e + '/index.m3u8?key=' + key
|
t = 'http://ksy-hls.renren.com/live/' + e + '/index.m3u8?key=' + key
|
||||||
return s
|
return t
|
||||||
elif livestate.group(1) == '1':
|
elif livestate.group(1) == '1':
|
||||||
return '回放:' + s
|
return '回放:' + s
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user