diff --git a/User.py b/User.py index a83d5c6..016cba8 100644 --- a/User.py +++ b/User.py @@ -14,15 +14,13 @@ class User: if "user" in json["Msg"]: self.ID = json["Msg"]['user']['user_id'] self.name = json["Msg"]['user']['name'] - self.type = json["Msg"]['user']['user_type'] if "discipulus_info" in json["Msg"]: self.level = json["Msg"]["discipulus_info"]["level"] self.brand = json["Msg"]["discipulus_info"]["discipulus_group_title"] elif "data" in json: if "anchorInfo" in json["data"]: - self.ID = json["data"]['anchorInfo']['user_id'] + self.ID = json["data"]['anchorInfo']['id'] self.name = json["data"]['anchorInfo']['name'] - self.type = 0 if self.type is None: self.type = 0 diff --git a/api.py b/api.py index d15e248..f5d4dc9 100644 --- a/api.py +++ b/api.py @@ -77,9 +77,13 @@ class XiGuaLiveApi: if not self.isValidRoom: return p = s.post("https://live.ixigua.com/api/room/enter/{roomID}".format(roomID=self.roomID)) + if DEBUG: + print(p.text) def updRoomInfo(self): - p = s.get("https://live.ixigua.com/api/room/{room}".format(room=self.room)) + p = s.get("https://live.ixigua.com/api/room?anchorId={room}".format(room=self.room)) + if DEBUG: + print(p.text) d = p.json() if "data" not in d: self.apiChangedError("无法获取RoomID,请与我联系") @@ -87,10 +91,9 @@ class XiGuaLiveApi: self.isValidRoom = True self._rawRoomInfo = d["data"] self.roomLiver = User(d) - self.roomTitle = self._rawRoomInfo["Title"] - self.roomPopularity = self._rawRoomInfo["Extra2"]["Popularity"] - if "Id" in d["data"]: - self.roomID = d["data"]["Id"] + self.roomTitle = self._rawRoomInfo["title"] + if "id" in d["data"]: + self.roomID = d["data"]["id"] else: self.apiChangedError("无法获取RoomID,请与我联系") if "FinishTime" in d["data"]: