From b8d76f6273f1438bac12d5cec67601f0e5dc2a62 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 7 Feb 2022 10:28:58 +0800 Subject: [PATCH] =?UTF-8?q?playlist=E6=8F=90=E5=8F=96=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96streamUrl=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Common.py b/Common.py index 461fe20..550fa29 100644 --- a/Common.py +++ b/Common.py @@ -311,7 +311,17 @@ def loginBilibili(force=False): class downloader(XiGuaLiveApi): - playlist = None + __playlist = None + + @property + def playlist(self): + return self.__playlist + + @playlist.setter + def playlist(self, value): + global streamUrl + self.__playlist = value + streamUrl = value def _checkUsernameIsMatched(self, compare=None): return True @@ -332,11 +342,9 @@ class downloader(XiGuaLiveApi): return _result def updPlayList(self): - global streamUrl if self.isLive and "stream_url" in self._rawRoomInfo: if 'rtmp_pull_url' in self._rawRoomInfo["stream_url"]: self.playlist = self._rawRoomInfo["stream_url"]['rtmp_pull_url'] - streamUrl = self.playlist elif 'flv_pull_url' in self._rawRoomInfo["stream_url"]: _playlist = self._rawRoomInfo["stream_url"]["flv_pull_url"] if type(_playlist) is dict: @@ -344,9 +352,7 @@ class downloader(XiGuaLiveApi): self.playlist = _ break self.playlist = self.playlist.replace("_hd5", "").replace("_sd5", "").replace("_ld5", "").replace("_md", "") - streamUrl = self.playlist else: - streamUrl = None self.playlist = None