1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-07-28 03:20:31 +08:00
This commit is contained in:
wbt5 2020-05-19 11:11:29 +08:00
parent c7eac24a64
commit 9bc448f5ef
5 changed files with 23 additions and 22 deletions

View File

@ -18,7 +18,9 @@
## 更新 ## 更新
### 2020.05.08新增优酷轮播台、look 直播、千帆直播; ### 2020.05.19更新火猫、快手、酷狗、PPS
2020.05.08新增优酷轮播台、look 直播、千帆直播;
- 新增优酷轮播台:优酷轮播台是优酷直播下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。 - 新增优酷轮播台:优酷轮播台是优酷直播下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
- 新增 LOOK 直播LOOK 直播是网易云音乐旗下的直播平台。 - 新增 LOOK 直播LOOK 直播是网易云音乐旗下的直播平台。

View File

@ -48,7 +48,9 @@ def get_real_url(rid):
response = requests.post(url=room_url, data=post_data).json() response = requests.post(url=room_url, data=post_data).json()
roomStatus = response.get('roomStatus', 0) roomStatus = response.get('roomStatus', 0)
if roomStatus == '1': if roomStatus == '1':
real_url = response.get('streamList')[0].get('list')[0] real_url_flv = response.get('streamList')[-1].get('list')[0].get('url')
real_url_m3u8 = response.get('streamList')[-1].get('list_hls')[0].get('url')
real_url = [real_url_flv, real_url_m3u8.replace('_480', '')]
else: else:
real_url = '直播间未开播' real_url = '直播间未开播'
else: else:
@ -58,5 +60,5 @@ def get_real_url(rid):
rid = input('请输入火猫直播房间号:\n') rid = input('请输入火猫直播房间号:\n')
real_url = get_real_url(rid) real_url = get_real_url(rid)
print('该直播间源地址为:\n') print('该直播间源地址为:')
print(real_url) print(real_url)

View File

@ -9,7 +9,8 @@ def get_real_url(rid):
try: try:
room_url = 'https://m.gifshow.com/fw/live/' + str(rid) room_url = 'https://m.gifshow.com/fw/live/' + str(rid)
headers = { 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 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
'cookie': 'did=web_'}
response = requests.get(url=room_url, headers=headers).text response = requests.get(url=room_url, headers=headers).text
m3u8_url = re.findall(r'type="application/x-mpegURL" src="([\s\S]*?)_sd1000(tp)?(/index)?.m3u8', response)[0] m3u8_url = re.findall(r'type="application/x-mpegURL" src="([\s\S]*?)_sd1000(tp)?(/index)?.m3u8', response)[0]
real_url = [m3u8_url[0] + i for i in ['.flv', '.m3u8']] real_url = [m3u8_url[0] + i for i in ['.flv', '.m3u8']]

View File

@ -5,11 +5,13 @@ import requests
def get_real_url(rid): def get_real_url(rid):
try: try:
response = requests.get('https://fx1.service.kugou.com/video/pc/live/pull/v3/streamaddr?roomId={}&ch=fx&version=1.0&streamType=1-2-5&platform=7&ua=fx-flash&kugouId=0&layout=1'.format(rid)).json() response1 = requests.get('https://fx1.service.kugou.com/video/pc/live/pull/v3/streamaddr?roomId={}&ch=fx&version=1.0&streamType=1-2-5&platform=7&ua=fx-flash&kugouId=0&layout=1'.format(rid)).json()
real_url = response.get('data').get('horizontal')[0].get('httpflv') response2 = requests.get('https://fx1.service.kugou.com/video/mo/live/pull/h5/v3/streamaddr?roomId={}&platform=18&version=1000&streamType=3-6&liveType=1&ch=fx&ua=fx-mobile-h5&kugouId=0&layout=1'.format(rid)).json()
real_url_flv = response1.get('data').get('horizontal')[0].get('httpflv')[0]
real_url_hls = response2.get('data').get('horizontal')[0].get('httpshls')[0]
except: except:
real_url = '直播间不存在或未开播' real_url_flv = real_url_hls = '直播间不存在或未开播'
return real_url return real_url_flv, real_url_hls
rid = input('请输入酷狗直播房间号:\n') rid = input('请输入酷狗直播房间号:\n')

22
pps.py
View File

@ -1,30 +1,24 @@
# 获取PPS奇秀直播的真实流媒体地址。 # 获取PPS奇秀直播的真实流媒体地址。
import requests import requests
import json
import re import re
import time
def get_real_url(rid): def get_real_url(rid):
try: try:
response = requests.get('http://m-x.pps.tv/room/' + str(rid)).text response = requests.get('http://m-x.pps.tv/room/' + str(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]
url = 'https://x.pps.tv/api/room/getStreamConfig' tt = int(time.time() * 1000)
params = { 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)
"type_id": 1,
"vid": 1,
"anchor_id": anchor_id,
}
headers = { headers = {
'Content-Type': 'application/json' 'Content-Type': 'application/x-www-form-urlencoded',
'Referer': 'http://m-x.pps.tv/'
} }
response = requests.post(url=url, data=json.dumps(params), headers=headers).json() response = requests.get(url=url, headers=headers).text
if response.get('data'): real_url = re.findall(r'"hls":"(.*)","rate_list', response)[0]
real_url = response.get('data').get('flv')
else:
real_url = '未开播'
except: except:
real_url = '直播间不存在' real_url = '直播间未开播或不存在'
return real_url return real_url