临时更新:未返回导致的错误
This commit is contained in:
parent
746f993a8d
commit
2df0dc07bd
12
api.py
12
api.py
@ -22,7 +22,6 @@ class XiGuaLiveApi:
|
|||||||
roomPopularity: int = 0
|
roomPopularity: int = 0
|
||||||
roomMember: int = 0
|
roomMember: int = 0
|
||||||
_cursor = ""
|
_cursor = ""
|
||||||
playlist: str = None
|
|
||||||
|
|
||||||
def __init__(self, room: int):
|
def __init__(self, room: int):
|
||||||
self.room = room
|
self.room = room
|
||||||
@ -96,12 +95,6 @@ class XiGuaLiveApi:
|
|||||||
self.roomTitle = d["data"]["title"]
|
self.roomTitle = d["data"]["title"]
|
||||||
self.roomID = d["data"]["id"]
|
self.roomID = d["data"]["id"]
|
||||||
self._updateRoomInfo(d)
|
self._updateRoomInfo(d)
|
||||||
if "playInfo" not in d["data"] or "Main" not in d["data"]["playInfo"]:
|
|
||||||
if self.playlist is None:
|
|
||||||
self.apiChangedError("无法获取直播链接")
|
|
||||||
self.playlist = False
|
|
||||||
else:
|
|
||||||
self.playlist = d["data"]["playInfo"]["Main"]["1"]["Url"]["HlsUrl"]
|
|
||||||
if "status" in d["data"] and d["data"]["status"] == 2:
|
if "status" in d["data"] and d["data"]["status"] == 2:
|
||||||
self.isLive = True
|
self.isLive = True
|
||||||
else:
|
else:
|
||||||
@ -119,7 +112,7 @@ class XiGuaLiveApi:
|
|||||||
if "data" not in d or "Extra" not in d["data"] or "Cursor" not in d["data"]["Extra"]:
|
if "data" not in d or "Extra" not in d["data"] or "Cursor" not in d["data"]["Extra"]:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(d)
|
print(d)
|
||||||
self.apiChangedError("数据结构改变,请与我联系", d)
|
self.apiChangedError("数据结构改变,请与我联系")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self._cursor = d["data"]["Extra"]["Cursor"]
|
self._cursor = d["data"]["Extra"]["Cursor"]
|
||||||
@ -127,9 +120,12 @@ class XiGuaLiveApi:
|
|||||||
print("Cursor", self._cursor)
|
print("Cursor", self._cursor)
|
||||||
if "LiveMsgs" not in d["data"]:
|
if "LiveMsgs" not in d["data"]:
|
||||||
self.updRoomInfo()
|
self.updRoomInfo()
|
||||||
|
return
|
||||||
for i in d['data']['LiveMsgs']:
|
for i in d['data']['LiveMsgs']:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(i)
|
print(i)
|
||||||
|
if "Method" not in i:
|
||||||
|
continue
|
||||||
if i['Method'] == "VideoLivePresentMessage":
|
if i['Method'] == "VideoLivePresentMessage":
|
||||||
self.onPresent(Gift(i))
|
self.onPresent(Gift(i))
|
||||||
elif i['Method'] == "VideoLivePresentEndTipMessage":
|
elif i['Method'] == "VideoLivePresentEndTipMessage":
|
||||||
|
Reference in New Issue
Block a user