From e3bfbe508924176e3b282f17b44efde8ba1c2f9a Mon Sep 17 00:00:00 2001 From: wbt5 Date: Fri, 31 Jul 2020 19:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=B0=E6=B5=AA=E7=96=AF?= =?UTF-8?q?=E6=92=AD=E7=9B=B4=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fengbolive.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 fengbolive.py diff --git a/fengbolive.py b/fengbolive.py new file mode 100644 index 0000000..3dd499c --- /dev/null +++ b/fengbolive.py @@ -0,0 +1,38 @@ +# 新浪疯播直播:http://www.fengbolive.com/list?type=hot +# 链接样式:http://www.fengbolive.com/live/88057518 +from Crypto.Cipher import AES +from urllib.parse import unquote +import base64 +import json +import requests + + +def fengbo(rid): + with requests.Session() as s: + res = s.get('https://external.fengbolive.com/cgi-bin/get_anchor_info_proxy.fcgi?anchorid=' + str(rid)).json() + if res['ret'] == 1: + info = res['info'] + info = unquote(info, 'utf-8') + + # 开始AES解密 + def pad(t): + return t + (16 - len(t) % 16) * b'\x00' + + key = iv = 'abcdefghqwertyui'.encode('utf8') + cipher = AES.new(key, AES.MODE_CBC, iv) + info = info.encode('utf8') + info = pad(info) + result = cipher.decrypt(base64.decodebytes(info)).rstrip(b'\0') + + result = json.loads(result.decode('utf-8')) + url = result['url'] + url = url.replace('hdl', 'hls') + url = url.replace('.flv', '/playlist.m3u8') + return url + else: + raise Exception('房间号错误') + + +if __name__ == '__main__': + r = input('输入疯播直播房间号:\n') + print(fengbo(r))