西瓜又升级了
This commit is contained in:
parent
7893bb0cd5
commit
09564f1748
@ -41,13 +41,17 @@ class User:
|
|||||||
self.type = json["extra"]["user_room_auth_status"]["user_type"]
|
self.type = json["extra"]["user_room_auth_status"]["user_type"]
|
||||||
self.block = json["extra"]["user_room_auth_status"]["is_block"]
|
self.block = json["extra"]["user_room_auth_status"]["is_block"]
|
||||||
self.mute = json["extra"]["user_room_auth_status"]["is_silence"]
|
self.mute = json["extra"]["user_room_auth_status"]["is_silence"]
|
||||||
elif "user_info" in json and json["user_info"] is not None:
|
if "user_info" in json and json["user_info"] is not None:
|
||||||
self.ID = json['user_info']['user_id']
|
self.ID = json['user_info']['user_id']
|
||||||
self.name = json['user_info']['name']
|
self.name = json['user_info']['name']
|
||||||
elif "anchor" in json and json["anchor"] is not None:
|
if "anchor" in json and json["anchor"] is not None:
|
||||||
if "user_info" in json["anchor"] and json["anchor"]['user_info'] is not None:
|
if "user_info" in json["anchor"] and json["anchor"]['user_info'] is not None:
|
||||||
self.ID = json["anchor"]['user_info']['user_id']
|
self.ID = json["anchor"]['user_info']['user_id']
|
||||||
self.name = json["anchor"]['user_info']['name']
|
self.name = json["anchor"]['user_info']['name']
|
||||||
|
if "user_id" in json:
|
||||||
|
self.ID = json["user_id"]
|
||||||
|
if "user_name" in json:
|
||||||
|
self.name = json["user_name"]
|
||||||
if self.type is None:
|
if self.type is None:
|
||||||
self.type = 0
|
self.type = 0
|
||||||
if isinstance(self.level, str):
|
if isinstance(self.level, str):
|
||||||
|
@ -192,12 +192,6 @@ if __name__ == "__main__":
|
|||||||
resetColor()
|
resetColor()
|
||||||
print("西瓜直播礼物助手 by JerryYan")
|
print("西瓜直播礼物助手 by JerryYan")
|
||||||
print("接口版本8.1.6")
|
print("接口版本8.1.6")
|
||||||
if len(sys.argv) > 1:
|
|
||||||
name = sys.argv[1]
|
|
||||||
if len(sys.argv) > 2:
|
|
||||||
SHOW_ALL = sys.argv[2] == "a"
|
|
||||||
else:
|
|
||||||
name = readInput("请输入主播用户名,默认为", name, 3)
|
|
||||||
print("搜索【", name, "】", end="\t", flush=True)
|
print("搜索【", name, "】", end="\t", flush=True)
|
||||||
api = WinMain(name)
|
api = WinMain(name)
|
||||||
if not api.isValidUser:
|
if not api.isValidUser:
|
||||||
|
7
api.py
7
api.py
@ -256,12 +256,15 @@ class XiGuaLiveApi:
|
|||||||
for i in d["data"]:
|
for i in d["data"]:
|
||||||
if self.broadcaster is not None:
|
if self.broadcaster is not None:
|
||||||
break
|
break
|
||||||
if i["block_type"] != 0:
|
if i["block_type"] != 2:
|
||||||
continue
|
continue
|
||||||
if "cells" not in i or len(i["cells"]) == 0:
|
if "cells" not in i or len(i["cells"]) == 0:
|
||||||
break
|
break
|
||||||
for _j in i["cells"]:
|
for _j in i["cells"]:
|
||||||
_user = User(_j)
|
if "room" in _j:
|
||||||
|
_user = User(_j["room"])
|
||||||
|
self.roomID = _j["room"]["room_id"]
|
||||||
|
self.isLive = _j["room"]["is_living"]
|
||||||
if self._checkUsernameIsMatched(_user):
|
if self._checkUsernameIsMatched(_user):
|
||||||
self.isValidUser = True
|
self.isValidUser = True
|
||||||
self.broadcaster = _user
|
self.broadcaster = _user
|
||||||
|
Reference in New Issue
Block a user