diff --git a/metadata/scripts/honey.py b/metadata/scripts/honey.py index 478f565f..e18cdb1f 100644 --- a/metadata/scripts/honey.py +++ b/metadata/scripts/honey.py @@ -45,7 +45,7 @@ async def get_avatar_data() -> DATA_TYPE: result = {} url = "https://genshin.honeyhunterworld.com/fam_chars/?lang=CHS" response = await request(url) - chaos_data = re.findall(r"sortable_data\.push\((.*)\);\s*sortable_cur_page", response.text)[0] + chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0] json_data = json.loads(chaos_data) # 转为 json for data in json_data: cid = int("10000" + re.findall(r"\d+", data[1])[0]) @@ -63,7 +63,7 @@ async def get_weapon_data() -> DATA_TYPE: urls = [HONEY_HOST.join(f"fam_{i.lower()}/?lang=CHS") for i in WeaponType.__members__] for url in urls: response = await request(url) - chaos_data = re.findall(r"sortable_data\.push\((.*)\);\s*sortable_cur_page", response.text)[0] + chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0] json_data = json.loads(chaos_data) # 转为 json for data in json_data: name = re.findall(r">(.*)<", data[1])[0] @@ -89,7 +89,7 @@ async def get_material_data() -> DATA_TYPE: for url in urls: response = await request(url) - chaos_data = re.findall(r"sortable_data\.push\((.*)\);\s*sortable_cur_page", response.text)[0] + chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0] json_data = json.loads(chaos_data) # 转为 json for data in json_data: honey_id = re.findall(r"/(.*?)/", data[1])[0] @@ -107,7 +107,7 @@ async def get_material_data() -> DATA_TYPE: async def get_artifact_data() -> DATA_TYPE: async def get_first_id(_link) -> str: _response = await request(_link) - _chaos_data = re.findall(r"sortable_data\.push\((.*)\);\s*sortable_cur_page", _response.text)[0] + _chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", _response.text)[0] _json_data = json.loads(_chaos_data) return re.findall(r"/(.*?)/", _json_data[-1][1])[0] @@ -118,7 +118,7 @@ async def get_artifact_data() -> DATA_TYPE: ambr_data = json.loads(response.text)["data"]["items"] response = await request(url) - chaos_data = re.findall(r"sortable_data\.push\((.*)\);\s*sortable_cur_page", response.text)[0] + chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0] json_data = json.loads(chaos_data) # 转为 json for data in json_data: honey_id = re.findall(r"/(.*?)/", data[1])[0] @@ -150,7 +150,7 @@ async def get_namecard_data() -> DATA_TYPE: result = {} response = await request(url) - chaos_data = re.findall(r"sortable_data\.push\((.*)\);\s*sortable_cur_page", response.text)[0] + chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0] json_data = json.loads(chaos_data) for data in json_data: honey_id = re.findall(r"/(.*?)/", data[1])[0]