♻️ remove: raiders

This commit is contained in:
xtaodada 2023-05-02 22:40:15 +08:00
parent 6a1333ebb5
commit f3590b49f5
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
33 changed files with 8 additions and 59 deletions

View File

@ -1,11 +1,12 @@
import asyncio
from res_func.avatar import fix_avatar_config
from res_func.avatar import fix_avatar_config, fetch_text_map
from res_func.light_cone import fix_light_cone_config
async def main():
await fix_avatar_config()
text_map_data = await fetch_text_map()
await fix_avatar_config(text_map_data)
await fix_light_cone_config()

View File

@ -1,49 +0,0 @@
import asyncio
import aiofiles
from pathlib import Path
import ujson
from func.fetch_all import get_list
from modules.apihelper.client.components.hyperion import Hyperion
data_path = Path("data/raiders")
data_path.mkdir(exist_ok=True, parents=True)
hyperion = Hyperion()
async def fetch_and_save_photo(name: str, url: str):
print(f"Fetch raider photo: {name} {url}")
pid = int(url.split("/")[-1])
img_list = await hyperion.get_images_by_post_id(6, pid)
if not img_list:
return
if len(img_list) < 3:
return
img = img_list[2]
async with aiofiles.open(data_path / f"{name}.png", "wb") as f:
await f.write(img.data)
async def get_raiders():
lists = await get_list("63")
maps = {}
for children in lists:
char_name = children.name
final_content = None
for content in children.list:
if content.article_user_name == "初始镜像OriginMirror":
final_content = content
break
if not final_content:
continue
if not final_content.bbs_url:
continue
maps[char_name] = final_content.bbs_url
tasks = []
for key, value in maps.items():
tasks.append(fetch_and_save_photo(key, value))
await asyncio.gather(*tasks)
async with aiofiles.open(data_path / "info.json", "w", encoding="utf-8") as f:
await f.write(ujson.dumps(list(maps.keys()), ensure_ascii=False, indent=4))

View File

@ -5,7 +5,7 @@ from pathlib import Path
src_dir = Path("src")
data_dir = Path("data")
pic_lists = ["avatar", "avatar_gacha", "destiny", "element"]
pic_lists = ["avatar_gacha", "destiny", "element"]
async def move_files():

View File

@ -6,7 +6,6 @@ from func.fetch_light_cones import fetch_light_cones, fetch_light_cones_infos, d
from func.fetch_materials import fetch_materials, fetch_materials_infos, dump_materials, read_materials
from func.fetch_monsters import fetch_monsters, fetch_monsters_infos, dump_monsters, read_monsters
from func.fetch_relics import fetch_relics, fetch_relics_infos, dump_relics, read_relics
from func.fetch_raiders import get_raiders
from func.fetch_src import move_files
data_path = Path("data")
@ -58,7 +57,6 @@ async def wiki(
async def bbs_photos():
await get_raiders()
await move_files()

View File

@ -17,13 +17,13 @@ async def fetch_text_map() -> Dict[str, str]:
return res.json()
async def fetch_config(text_map: Dict[str, str]) -> List[AvatarConfig]:
async def fetch_config(text_map_data: Dict[str, str]) -> List[AvatarConfig]:
res = await client.get(avatar_config)
data = res.json()
datas = []
for i in data.values():
a = AvatarConfig(**i)
a.name = text_map[str(a.AvatarName.Hash)]
a.name = text_map_data[str(a.AvatarName.Hash)]
datas.append(a)
return datas
@ -76,8 +76,7 @@ async def fetch_station(configs_map: Dict[str, AvatarConfig]) -> List[AvatarIcon
return datas
async def fix_avatar_config():
text_map_data = await fetch_text_map()
async def fix_avatar_config(text_map_data: Dict[str, str]):
configs = await fetch_config(text_map_data)
configs_map: Dict[str, AvatarConfig] = {config.name: config for config in configs}
configs_map["开拓者"] = configs_map["{NICKNAME}"]

View File

@ -1,6 +1,6 @@
import asyncio
from pathlib import Path
from typing import Dict, List
from typing import List
import aiofiles
import ujson

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB