From da9f6c3506bcd0ea5a377eaebf3ff3130ab862fa Mon Sep 17 00:00:00 2001 From: wbt5 Date: Fri, 31 Jul 2020 19:37:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B0=8F=E7=B1=B3=E7=9B=B4?= =?UTF-8?q?=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wali.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 wali.py diff --git a/wali.py b/wali.py new file mode 100644 index 0000000..b6d5ef2 --- /dev/null +++ b/wali.py @@ -0,0 +1,19 @@ +# 小米直播:https://live.wali.com/fe +import requests + + +def wali(rid): + zuid = rid.split('_')[0] + with requests.Session() as s: + res = s.get('https://s.zb.mi.com/get_liveinfo?lid={}&zuid={}'.format(rid, zuid)).json() + status = res['data']['status'] + if status == 1: + flv = res['data']['video']['flv'] + return flv.replace('http', 'https') + else: + raise Exception('直播间不存在或未开播') + + +if __name__ == '__main__': + r = input('输入小米直播房间号:\n') + print(wali(r))