From 3fede548a851863ca01a008b0358c6580b936faa Mon Sep 17 00:00:00 2001 From: HornCopper Date: Mon, 16 Sep 2024 12:17:51 +0800 Subject: [PATCH] [feat]update serendipity info source --- src/plugins/jx3/horse/api.py | 2 +- src/plugins/jx3/serendipity/without_jx3api.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/plugins/jx3/horse/api.py b/src/plugins/jx3/horse/api.py index 8d787b9d..4fb795a0 100644 --- a/src/plugins/jx3/horse/api.py +++ b/src/plugins/jx3/horse/api.py @@ -80,7 +80,7 @@ def parse_info(raw_msg: str, flush_time: str): chitu_flushed = False if is_in_current_cycle(ct_data["data"]["list"][0]["time"]): chitu_flushed = True - dl_data = await get_api(f"https://next2.jx3box.com/api/game/reporter/horse?pageIndex=1&pageSize=50&server{server}&type=dilu-horse&subtype=share_msg") + dl_data = await get_api(f"https://next2.jx3box.com/api/game/reporter/horse?pageIndex=1&pageSize=50&server={server}&type=dilu-horse&subtype=share_msg") dilu_flushed = False if is_in_current_week(dl_data["data"]["list"][0]["time"]): dilu_flushed = True diff --git a/src/plugins/jx3/serendipity/without_jx3api.py b/src/plugins/jx3/serendipity/without_jx3api.py index c3777c22..278fa2e4 100644 --- a/src/plugins/jx3/serendipity/without_jx3api.py +++ b/src/plugins/jx3/serendipity/without_jx3api.py @@ -1,6 +1,7 @@ from src.tools.config import Config from src.tools.utils.request import post_url, get_api, get_url from src.tools.basic.jx3 import gen_ts, gen_xsk, format_body +from src.tools.basic.server import Zone_mapping from src.tools.utils.path import ASSETS from src.plugins.jx3.bind import get_player_local_data, Player @@ -27,6 +28,7 @@ def __init__(self): self.tl = [] self.my = [] self.jx3pet = [] + self.jx3mm = [] def get_serendipity_level(self, serendipity_name: str) -> int: if serendipity_name.find("宠物奇缘") != -1: @@ -120,8 +122,23 @@ async def get_jx3pet_data(self, server: str, name: str): ) self.jx3pet = serendipities + async def get_jx3mm_data(self, server: str, name: str): + final_url = f"https://www.jx3mm.com/home/qyinfo?m=1&R={Zone_mapping(server)}&S={server}&t=&u=&n={name}" + data = await get_api(final_url) + serendipities = [] + for serendipity in data["result"]: + serendipities.append( + { + "name": serendipity["serendipity"], + "level": self.get_serendipity_level(serendipity["serendipity"]), + "time": serendipity["time"] + } + ) + self.jx3mm = serendipities + async def integration(self, server: str, name: str): await self.get_tuilan_data(server, name) await self.get_my_data(server, name) await self.get_jx3pet_data(server, name) - return sort_list_of_dicts(merge_dict_lists(merge_dict_lists(self.tl, self.my), self.jx3pet), "time")[::-1] \ No newline at end of file + await self.get_jx3mm_data(server, name) + return sort_list_of_dicts(merge_dict_lists(merge_dict_lists(merge_dict_lists(self.tl, self.my), self.jx3pet), self.jx3mm), "time")[::-1] \ No newline at end of file