1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-12-16 23:10:29 +08:00
zhibo-url/9xiu.py
2020-07-31 19:44:50 +08:00

27 lines
876 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 九秀直播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))