mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-25 23:49:11 +00:00
🐛 Fix ValueError in Func update_honey_metadata
This commit is contained in:
parent
9e2945dca4
commit
645285ab6b
@ -45,7 +45,7 @@ async def get_avatar_data() -> DATA_TYPE:
|
|||||||
result = {}
|
result = {}
|
||||||
url = "https://genshin.honeyhunterworld.com/fam_chars/?lang=CHS"
|
url = "https://genshin.honeyhunterworld.com/fam_chars/?lang=CHS"
|
||||||
response = await request(url)
|
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
|
json_data = json.loads(chaos_data) # 转为 json
|
||||||
for data in json_data:
|
for data in json_data:
|
||||||
cid = int("10000" + re.findall(r"\d+", data[1])[0])
|
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__]
|
urls = [HONEY_HOST.join(f"fam_{i.lower()}/?lang=CHS") for i in WeaponType.__members__]
|
||||||
for url in urls:
|
for url in urls:
|
||||||
response = await request(url)
|
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
|
json_data = json.loads(chaos_data) # 转为 json
|
||||||
for data in json_data:
|
for data in json_data:
|
||||||
name = re.findall(r">(.*)<", data[1])[0]
|
name = re.findall(r">(.*)<", data[1])[0]
|
||||||
@ -89,7 +89,7 @@ async def get_material_data() -> DATA_TYPE:
|
|||||||
|
|
||||||
for url in urls:
|
for url in urls:
|
||||||
response = await request(url)
|
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
|
json_data = json.loads(chaos_data) # 转为 json
|
||||||
for data in json_data:
|
for data in json_data:
|
||||||
honey_id = re.findall(r"/(.*?)/", data[1])[0]
|
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_artifact_data() -> DATA_TYPE:
|
||||||
async def get_first_id(_link) -> str:
|
async def get_first_id(_link) -> str:
|
||||||
_response = await request(_link)
|
_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)
|
_json_data = json.loads(_chaos_data)
|
||||||
return re.findall(r"/(.*?)/", _json_data[-1][1])[0]
|
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"]
|
ambr_data = json.loads(response.text)["data"]["items"]
|
||||||
|
|
||||||
response = await request(url)
|
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
|
json_data = json.loads(chaos_data) # 转为 json
|
||||||
for data in json_data:
|
for data in json_data:
|
||||||
honey_id = re.findall(r"/(.*?)/", data[1])[0]
|
honey_id = re.findall(r"/(.*?)/", data[1])[0]
|
||||||
@ -150,7 +150,7 @@ async def get_namecard_data() -> DATA_TYPE:
|
|||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
response = await request(url)
|
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_data = json.loads(chaos_data)
|
||||||
for data in json_data:
|
for data in json_data:
|
||||||
honey_id = re.findall(r"/(.*?)/", data[1])[0]
|
honey_id = re.findall(r"/(.*?)/", data[1])[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user