HonkaiStarRailWikiDataParser/main.py

30 lines
1.0 KiB
Python
Raw Normal View History

2023-04-23 14:06:11 +00:00
import asyncio
from pathlib import Path
from func.fetch_all import get_list
2023-04-23 15:18:42 +00:00
from func.fetch_avatars import fetch_avatars, fetch_avatars_infos, dump_avatars, read_avatars
from func.fetch_materials import fetch_materials, fetch_materials_infos, dump_materials, read_materials
2023-04-23 14:06:11 +00:00
data_path = Path("data")
data_path.mkdir(exist_ok=True)
2023-04-23 15:18:42 +00:00
async def main(override: bool = True):
2023-04-23 14:06:11 +00:00
main_data = await get_list()
2023-04-23 15:18:42 +00:00
if override:
await fetch_materials(main_data[4])
2023-04-23 15:31:19 +00:00
await fetch_materials(main_data[5], "消耗品")
await fetch_materials(main_data[8], "任务道具")
await fetch_materials(main_data[9], "贵重物")
await fetch_materials(main_data[10])
2023-04-23 15:18:42 +00:00
await fetch_materials_infos()
await dump_materials(data_path / "materials.json")
else:
await read_materials(data_path / "materials.json")
await fetch_avatars(main_data[0])
await fetch_avatars_infos()
await dump_avatars(data_path / "avatars.json")
2023-04-23 14:06:11 +00:00
if __name__ == '__main__':
asyncio.run(main())