1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-06-16 15:59:57 +08:00

Improve NOW直播

-优化代码
This commit is contained in:
wbt5 2021-11-21 15:42:41 +08:00
parent ae088352a6
commit 73cfbc9125
No known key found for this signature in database
GPG Key ID: 92D5C42E815A2BD6

4
now.py
View File

@ -10,7 +10,7 @@ class Now:
def get_real_url(self):
try:
room_url = 'https://now.qq.com/cgi-bin/now/web/room/get_live_room_url?room_id={}&platform=8'.format(self.rid)
room_url = f'https://now.qq.com/cgi-bin/now/web/room/get_live_room_url?room_id={self.rid}&platform=8'
response = requests.get(url=room_url).json()
result = response.get('result')
real_url = {
@ -18,7 +18,7 @@ class Now:
'raw_rtmp_url': result.get('raw_rtmp_url', 0),
'raw_flv_url': result.get('raw_flv_url', 0)
}
except:
except Exception:
raise Exception('直播间不存在或未开播')
return real_url