mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-29 21:00:30 +08:00
Compare commits
4 Commits
cab036f982
...
af57d695e4
Author | SHA1 | Date | |
---|---|---|---|
|
af57d695e4 | ||
|
009574e918 | ||
|
e3b91d4c88 | ||
|
f26b0f4c03 |
3
2cq.py
3
2cq.py
@ -10,7 +10,7 @@ class MHT:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('https://www.2cq.com/proxy/room/room/info?roomId={}&appId=1004'.format(self.rid))
|
||||
res = s.get(f'https://www.2cq.com/proxy/room/room/info?roomId={self.rid}&appId=1004')
|
||||
res = res.json()
|
||||
if res['status'] == 1:
|
||||
result = res['result']
|
||||
@ -35,4 +35,3 @@ def get_real_url(rid):
|
||||
if __name__ == '__main__':
|
||||
r = input('输入棉花糖直播房间号:\n')
|
||||
print(get_real_url(r))
|
||||
|
||||
|
5
95xiu.py
5
95xiu.py
@ -11,14 +11,14 @@ class JWXiu:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
res = s.get('http://www.95.cn/{}.html'.format(self.rid)).text
|
||||
res = s.get(f'https://www.95.cn/{self.rid}.html').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)
|
||||
real_url = f'https://play1.95xiu.com/app/{uid}.flv'
|
||||
return real_url
|
||||
else:
|
||||
raise Exception('未开播')
|
||||
@ -36,4 +36,3 @@ def get_real_url(rid):
|
||||
if __name__ == '__main__':
|
||||
r = input('输入95秀房间号:\n')
|
||||
print(get_real_url(r))
|
||||
|
||||
|
2
9xiu.py
2
9xiu.py
@ -10,7 +10,7 @@ class JXiu:
|
||||
|
||||
def get_real_url(self):
|
||||
with requests.Session() as s:
|
||||
url = 'https://h5.9xiu.com/room/live/enterRoom?rid=' + str( self.rid)
|
||||
url = f'https://h5.9xiu.com/room/live/enterRoom?rid={self.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'
|
||||
|
@ -19,6 +19,11 @@ import requests
|
||||
class sIQiYi:
|
||||
|
||||
def __init__(self, rid):
|
||||
"""
|
||||
收费直播间、未开播直播间、已结束直播间获取到的地址均无法播放;
|
||||
Args:
|
||||
rid: 这里传入完整的直播间地址
|
||||
"""
|
||||
url = rid
|
||||
self.rid = url.split('/')[-1]
|
||||
self.s = requests.Session()
|
||||
@ -50,8 +55,8 @@ class sIQiYi:
|
||||
i = n[:y - x]
|
||||
n = n[y - x:]
|
||||
|
||||
for r in range(0, len(a)):
|
||||
if a[r] == n[r]:
|
||||
for rs, ele in enumerate(a):
|
||||
if ele == n[rs]:
|
||||
i += '0'
|
||||
else:
|
||||
i += '1'
|
||||
@ -108,12 +113,17 @@ class sIQiYi:
|
||||
# 请求url
|
||||
url = f'https://live.video.iqiyi.com{k}&vf={vf}'
|
||||
res = self.s.get(url).text
|
||||
|
||||
data = re.search(r'try{\w{33}\(([\w\W]+)\s\);}catch\(e\){};', res).group(1)
|
||||
data = json.loads(data)
|
||||
if data['code'] == 'A00004':
|
||||
raise Exception('直播间地址错误!')
|
||||
elif data['code'] == 'A00000':
|
||||
try:
|
||||
res, = re.findall(r'try{[\s\S]{33}\((.*)\);}catch\(e\){};', res)
|
||||
url = json.loads(res)['data']['streams'][-1]['url']
|
||||
except ValueError:
|
||||
raise Exception('Incorrect rid.')
|
||||
url = data['data']['streams'][-1]['url']
|
||||
except IndexError:
|
||||
raise Exception('可能直播未开始直播或为付费直播!')
|
||||
else:
|
||||
raise Exception('无法定位错误原因,可提交issue!')
|
||||
return url
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user