playlist提取,优化streamUrl设置
This commit is contained in:
parent
29d23a38d2
commit
b8d76f6273
16
Common.py
16
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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user