-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import asyncio | ||
from pathlib import Path | ||
|
||
import aiofiles | ||
|
||
from func.client import client, retry | ||
from func.url import mihomo_map_url | ||
|
||
data_dir = Path("data") / "mihomo_map" | ||
data_dir.mkdir(exist_ok=True, parents=True) | ||
file_set = { | ||
"characters.json", | ||
"character_ranks.json", | ||
"character_skills.json", | ||
"character_skill_trees.json", | ||
"character_promotions.json", | ||
"light_cones.json", | ||
"light_cone_ranks.json", | ||
"light_cone_promotions.json", | ||
"relics.json", | ||
"relic_sets.json", | ||
"relic_main_affixes.json", | ||
"relic_sub_affixes.json", | ||
"paths.json", | ||
"elements.json", | ||
"properties.json", | ||
"avatars.json", | ||
} | ||
|
||
|
||
@retry | ||
async def fetch_file(filename: str) -> None: | ||
req = await client.get(mihomo_map_url + filename) | ||
async with aiofiles.open(data_dir / filename, "wb") as f: | ||
await f.write(req.content) | ||
|
||
|
||
async def fetch_files(): | ||
print("获取 mihomo map 文件") | ||
tasks = [fetch_file(file) for file in file_set] | ||
await asyncio.gather(*tasks) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
base_url = "https://api-static.mihoyo.com/common/blackboard/sr_wiki/v1" | ||
list_url = f"{base_url}/home/content/list" | ||
|
||
mihomo_map_url = "https://raw.githubusercontent.com/Mar-7th/StarRailRes/master/index_min/cn/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters