You've already forked XiguaLiveDanmakuHelper
Compare commits
3 Commits
v0.2-beta.
...
v0.2.1-bet
Author | SHA1 | Date | |
---|---|---|---|
b8b793e292 | |||
e4fef3df33 | |||
54fa20c4f7 |
5
Gift.py
5
Gift.py
@ -6,7 +6,7 @@ class Gift:
|
|||||||
ID:int = 0
|
ID:int = 0
|
||||||
count:int = 0
|
count:int = 0
|
||||||
roomID:int = 0
|
roomID:int = 0
|
||||||
giftList:dict = {10001: {"Name": "西瓜", "Price": 0}}
|
giftList:dict = {}
|
||||||
amount:int = 0
|
amount:int = 0
|
||||||
user:User = None
|
user:User = None
|
||||||
|
|
||||||
@ -33,7 +33,8 @@ class Gift:
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def update(self):
|
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()
|
d = p.json()
|
||||||
if "gift_info" not in d:
|
if "gift_info" not in d:
|
||||||
print("错误:礼物更新失败")
|
print("错误:礼物更新失败")
|
||||||
|
@ -2,6 +2,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from Gift import Gift
|
from Gift import Gift
|
||||||
from Lottery import Lottery
|
from Lottery import Lottery
|
||||||
from MemberMsg import MemberMsg
|
from MemberMsg import MemberMsg
|
||||||
@ -192,6 +194,9 @@ if __name__ == "__main__":
|
|||||||
os.system("title {}".format(api.getTitle()))
|
os.system("title {}".format(api.getTitle()))
|
||||||
try:
|
try:
|
||||||
api.getDanmaku()
|
api.getDanmaku()
|
||||||
|
except requests.exceptions.BaseHTTPError:
|
||||||
|
print("网络错误,请确认网络")
|
||||||
|
time.sleep(5)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e.__str__())
|
print(e.__str__())
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
3
api.py
3
api.py
@ -221,6 +221,9 @@ if __name__ == "__main__":
|
|||||||
if api.isLive:
|
if api.isLive:
|
||||||
try:
|
try:
|
||||||
api.getDanmaku()
|
api.getDanmaku()
|
||||||
|
except requests.exceptions.BaseHTTPError:
|
||||||
|
print("网络错误,请确认网络")
|
||||||
|
time.sleep(5)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -24,7 +24,7 @@ class downloader(XiGuaLiveApi):
|
|||||||
|
|
||||||
def updPlayList(self):
|
def updPlayList(self):
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
if "stream_url" not in self._rawRoomInfo:
|
if "stream_url" in self._rawRoomInfo:
|
||||||
if self.playlist is None:
|
if self.playlist is None:
|
||||||
self.apiChangedError("无法获取直播链接")
|
self.apiChangedError("无法获取直播链接")
|
||||||
self.playlist = False
|
self.playlist = False
|
||||||
@ -79,8 +79,11 @@ class downloader(XiGuaLiveApi):
|
|||||||
print("{} : Add Sequence {}".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"),
|
print("{} : Add Sequence {}".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"),
|
||||||
len(self.files)))
|
len(self.files)))
|
||||||
q.put(i)
|
q.put(i)
|
||||||
|
else:
|
||||||
|
print("PlayList {}".format(self.playlist))
|
||||||
self.genNewName()
|
self.genNewName()
|
||||||
|
|
||||||
|
|
||||||
def genNewName(self):
|
def genNewName(self):
|
||||||
if len(self.files) > 800:
|
if len(self.files) > 800:
|
||||||
q.put(True)
|
q.put(True)
|
||||||
@ -169,10 +172,7 @@ if __name__ == "__main__":
|
|||||||
ut = threading.Thread(target=upload, args=(d,))
|
ut = threading.Thread(target=upload, args=(d,))
|
||||||
ut.setDaemon(True)
|
ut.setDaemon(True)
|
||||||
ut.start()
|
ut.start()
|
||||||
try:
|
api.preDownload()
|
||||||
api.preDownload()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
else:
|
else:
|
||||||
if d is not None:
|
if d is not None:
|
||||||
|
Reference in New Issue
Block a user