1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-06-17 08:25:25 +08:00

新增九秀直播

This commit is contained in:
wbt5 2020-07-31 19:44:50 +08:00
parent 60875bb202
commit b5090adea9

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))