You've already forked XiguaLiveDanmakuHelper
Compare commits
7 Commits
v0.2-beta
...
v0.2.1-bet
Author | SHA1 | Date | |
---|---|---|---|
e4fef3df33 | |||
54fa20c4f7 | |||
89edd10dc2 | |||
ebe01566c0 | |||
a0f76eb00b | |||
f81c2811ce | |||
c12d8cf4bb |
5
Gift.py
5
Gift.py
@ -6,7 +6,7 @@ class Gift:
|
||||
ID:int = 0
|
||||
count:int = 0
|
||||
roomID:int = 0
|
||||
giftList:dict = {10001: {"Name": "西瓜", "Price": 0}}
|
||||
giftList:dict = {}
|
||||
amount:int = 0
|
||||
user:User = None
|
||||
|
||||
@ -33,7 +33,8 @@ class Gift:
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
p = requests.get("https://i.snssdk.com/videolive/gift/get_gift_list?room_id={roomID}".format(roomID = self.roomID))
|
||||
p = requests.get("https://i.snssdk.com/videolive/gift/get_gift_list?room_id={roomID}"
|
||||
"&version_code=730&device_platform=android".format(roomID = self.roomID))
|
||||
d = p.json()
|
||||
if "gift_info" not in d:
|
||||
print("错误:礼物更新失败")
|
||||
|
8
api.py
8
api.py
@ -189,9 +189,10 @@ class XiGuaLiveApi:
|
||||
self.onLike(User(i))
|
||||
else:
|
||||
pass
|
||||
self.lottery = Lottery(i)
|
||||
if self.lottery is None or self.lottery.ID == 0:
|
||||
self.lottery = Lottery(i)
|
||||
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()
|
||||
if self.lottery.isFinished:
|
||||
self.onLottery(self.lottery)
|
||||
@ -203,8 +204,7 @@ class XiGuaLiveApi:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# name = "永恒de草薙"
|
||||
name = "尤美"
|
||||
name = "永恒de草薙"
|
||||
if len(sys.argv) > 2:
|
||||
if sys.argv[-1] == "d":
|
||||
DEBUG = True
|
||||
|
@ -23,13 +23,16 @@ class downloader(XiGuaLiveApi):
|
||||
self.updPlayList()
|
||||
|
||||
def updPlayList(self):
|
||||
if "stream_url" not in self._rawRoomInfo:
|
||||
if self.playlist is None:
|
||||
self.apiChangedError("无法获取直播链接")
|
||||
self.playlist = False
|
||||
if self.isLive:
|
||||
if "stream_url" in self._rawRoomInfo:
|
||||
if self.playlist is None:
|
||||
self.apiChangedError("无法获取直播链接")
|
||||
self.playlist = False
|
||||
else:
|
||||
self.playlist = self._rawRoomInfo["stream_url"]["alternate_pull_url"]
|
||||
self.playlist = self.playlist.replace("_uhd","").replace("_sd","").replace("_ld","")
|
||||
else:
|
||||
self.playlist = self._rawRoomInfo["stream_url"]["alternate_pull_url"]
|
||||
self.playlist = self.playlist.replace("_uhd","").replace("_sd","").replace("_ld","")
|
||||
print("未开播,等待开播")
|
||||
|
||||
def onLike(self, user):
|
||||
pass
|
||||
@ -76,8 +79,11 @@ class downloader(XiGuaLiveApi):
|
||||
print("{} : Add Sequence {}".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"),
|
||||
len(self.files)))
|
||||
q.put(i)
|
||||
else:
|
||||
print("PlayList {}".format(self.playlist))
|
||||
self.genNewName()
|
||||
|
||||
|
||||
def genNewName(self):
|
||||
if len(self.files) > 800:
|
||||
q.put(True)
|
||||
@ -166,10 +172,7 @@ if __name__ == "__main__":
|
||||
ut = threading.Thread(target=upload, args=(d,))
|
||||
ut.setDaemon(True)
|
||||
ut.start()
|
||||
try:
|
||||
api.preDownload()
|
||||
except:
|
||||
pass
|
||||
api.preDownload()
|
||||
time.sleep(3)
|
||||
else:
|
||||
if d is not None:
|
||||
|
Reference in New Issue
Block a user