From 4a16c843f25bffb604dc07138c7e48a18a9ab2dc Mon Sep 17 00:00:00 2001 From: wbt5 Date: Fri, 10 Jan 2020 00:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=BE=99=E7=8F=A0=E7=9B=B4?= =?UTF-8?q?=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- longzhu.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 longzhu.py diff --git a/longzhu.py b/longzhu.py new file mode 100644 index 0000000..f3174b6 --- /dev/null +++ b/longzhu.py @@ -0,0 +1,21 @@ +# 获取龙珠直播的真实流媒体地址,默认最高码率。 + +import requests +import re + + +def get_real_url(rid): + try: + response = requests.get('http://m.longzhu.com/' + str(rid)).text + roomId = re.findall(r'roomId = (\d*);', response)[0] + response = requests.get('http://livestream.longzhu.com/live/getlivePlayurl?roomId={}&hostPullType=2&isAdvanced=true&playUrlsType=1'.format(roomId)).json() + real_url = response.get('playLines')[0].get('urls')[-1].get('securityUrl') + except: + real_url = '直播间不存在或未开播' + return real_url + + +rid = input('请输入龙珠直播房间号:\n') +real_url = get_real_url(rid) +print('该直播间源地址为:') +print(real_url)