From 76269decd93a233893e53162f219bf7a1717be5f Mon Sep 17 00:00:00 2001 From: wbt5 Date: Fri, 31 Jul 2020 19:38:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=81=E9=B9=85=E4=BD=93?= =?UTF-8?q?=E8=82=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qie.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 qie.py diff --git a/qie.py b/qie.py new file mode 100644 index 0000000..3d05750 --- /dev/null +++ b/qie.py @@ -0,0 +1,22 @@ +# 企鹅体育:https://live.qq.com/directory/all +import requests +import re + + +def qie(rid): + with requests.Session() as s: + res = s.get('https://m.live.qq.com/' + str(rid)) + show_status = re.search(r'"show_status":"(\d)"', res.text) + if show_status: + if show_status.group(1) == '1': + hls_url = re.search(r'"hls_url":"(.*)","use_p2p"', res.text).group(1) + return hls_url + else: + raise Exception('未开播') + else: + raise Exception('直播间不存在') + + +if __name__ == '__main__': + r = input('输入企鹅体育直播间号:\n') + print(qie(r))