From 245081dca3d0d96cbd7adf472f290d7506ffb782 Mon Sep 17 00:00:00 2001 From: wbt5 Date: Fri, 31 Jul 2020 19:41:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E95=E7=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 95xiu.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 95xiu.py diff --git a/95xiu.py b/95xiu.py new file mode 100644 index 0000000..376d186 --- /dev/null +++ b/95xiu.py @@ -0,0 +1,23 @@ +# 95秀:http://www.95.cn/ +import requests +import re + + +def jwxiu(rid): + with requests.Session() as s: + res = s.get('http://www.95.cn/{}.html'.format(rid)).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) + return real_url + else: + raise Exception('未开播') + + +if __name__ == '__main__': + r = input('输入95秀房间号:\n') + print(jwxiu(r))