From cc76a3f9753e18b27d72fa94fcedc1c7e25559e6 Mon Sep 17 00:00:00 2001 From: wbt5 Date: Fri, 31 Jul 2020 19:45:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=89=E8=8A=B1=E7=B3=96?= =?UTF-8?q?=E7=9B=B4=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2cq.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 2cq.py diff --git a/2cq.py b/2cq.py new file mode 100644 index 0000000..1fadc1b --- /dev/null +++ b/2cq.py @@ -0,0 +1,22 @@ +# 棉花糖直播:https://www.2cq.com/rank +import requests + + +def mht(rid): + with requests.Session() as s: + res = s.get('https://www.2cq.com/proxy/room/room/info?roomId={}&appId=1004'.format(rid)) + res = res.json() + if res['status'] == 1: + result = res['result'] + if result['liveState'] == 1: + real_url = result['pullUrl'] + return real_url + else: + raise Exception('未开播') + else: + raise Exception('直播间可能不存在') + + +if __name__ == '__main__': + r = input('输入棉花糖直播房间号:\n') + print(mht(r))