5 Commits

2 changed files with 13 additions and 10 deletions

6
api.py
View File

@ -189,9 +189,10 @@ class XiGuaLiveApi:
self.onLike(User(i)) self.onLike(User(i))
else: else:
pass pass
if self.lottery is None or self.lottery.ID == 0:
self.lottery = Lottery(i) self.lottery = Lottery(i)
self._updRoomCount += 1 self._updRoomCount += 1
if self.lottery is not None or self.lottery.ID != 0: if self.lottery is not None and self.lottery.ID != 0:
self.lottery.update() self.lottery.update()
if self.lottery.isFinished: if self.lottery.isFinished:
self.onLottery(self.lottery) self.onLottery(self.lottery)
@ -203,8 +204,7 @@ class XiGuaLiveApi:
if __name__ == "__main__": if __name__ == "__main__":
# name = "永恒de草薙" name = "永恒de草薙"
name = "尤美"
if len(sys.argv) > 2: if len(sys.argv) > 2:
if sys.argv[-1] == "d": if sys.argv[-1] == "d":
DEBUG = True DEBUG = True

View File

@ -23,6 +23,7 @@ class downloader(XiGuaLiveApi):
self.updPlayList() self.updPlayList()
def updPlayList(self): def updPlayList(self):
if self.isLive:
if "stream_url" not in self._rawRoomInfo: if "stream_url" not in self._rawRoomInfo:
if self.playlist is None: if self.playlist is None:
self.apiChangedError("无法获取直播链接") self.apiChangedError("无法获取直播链接")
@ -30,6 +31,8 @@ class downloader(XiGuaLiveApi):
else: else:
self.playlist = self._rawRoomInfo["stream_url"]["alternate_pull_url"] self.playlist = self._rawRoomInfo["stream_url"]["alternate_pull_url"]
self.playlist = self.playlist.replace("_uhd","").replace("_sd","").replace("_ld","") self.playlist = self.playlist.replace("_uhd","").replace("_sd","").replace("_ld","")
else:
print("未开播,等待开播")
def onLike(self, user): def onLike(self, user):
pass pass