mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🐛 Fix namecard parse
This commit is contained in:
parent
6f09d52ec5
commit
235f9f349e
@ -189,5 +189,5 @@ async def update_honey_metadata(overwrite: bool = True) -> FULL_DATA_TYPE | None
|
||||
}
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
async with async_open(path, mode="w", encoding="utf-8") as file:
|
||||
await file.write(json.dumps(result, ensure_ascii=False))
|
||||
await file.write(json.dumps(result, ensure_ascii=False, indent=4))
|
||||
return result
|
||||
|
@ -42,7 +42,7 @@ async def update_metadata_from_ambr(overwrite: bool = True):
|
||||
json_data = json.loads(response.text)["data"]["items"]
|
||||
await fix_metadata_from_ambr(json_data, target)
|
||||
async with async_open(path, mode="w", encoding="utf-8") as file:
|
||||
data = json.dumps(json_data, ensure_ascii=False)
|
||||
data = json.dumps(json_data, ensure_ascii=False, indent=4)
|
||||
await file.write(data)
|
||||
result.append(json_data)
|
||||
return result
|
||||
@ -75,10 +75,10 @@ async def update_metadata_from_github(overwrite: bool = True):
|
||||
started = False
|
||||
cell = []
|
||||
async for line in response.aiter_lines():
|
||||
if line == " {\n":
|
||||
if line == " {":
|
||||
started = True
|
||||
continue
|
||||
if line in [" },\n", " }\n"]:
|
||||
if line in [" },", " }"]:
|
||||
started = False
|
||||
if any("MATERIAL_NAMECARD" in x for x in cell):
|
||||
material_json_data.append(json.loads("{" + "".join(cell) + "}"))
|
||||
@ -89,7 +89,7 @@ async def update_metadata_from_github(overwrite: bool = True):
|
||||
cell = []
|
||||
started = False
|
||||
continue
|
||||
cell.append(line.strip(" \n"))
|
||||
cell.append(line.strip(" "))
|
||||
|
||||
string_ids = []
|
||||
for namecard_data in material_json_data:
|
||||
@ -129,7 +129,7 @@ async def update_metadata_from_github(overwrite: bool = True):
|
||||
}
|
||||
)
|
||||
async with async_open(path, mode="w", encoding="utf-8") as file:
|
||||
data = json.dumps(data, ensure_ascii=False)
|
||||
data = json.dumps(data, ensure_ascii=False, indent=4)
|
||||
await file.write(data)
|
||||
return data
|
||||
except RemoteProtocolError as exc:
|
||||
|
Loading…
Reference in New Issue
Block a user