Spaces:
Runtime error
Runtime error
File size: 569 Bytes
cab1b96 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import json
with open('mappings.json') as f:
df = json.load(f)
conf = {}
with open("/Users/nakamura/git/kunshujo/kunshujo/static/data/index.json") as f:
items = json.load(f)
for item in items:
conf[item["objectID"]] = item
for index in df:
item = df[index]
id = item["nconst"]
if id not in conf:
continue
c = conf[id]
item["url"] = c["thumbnail"]
item["name"] = c["label"]
with open('../models/mappings.json', mode='wt', encoding='utf-8') as file:
json.dump(df, file, ensure_ascii=False, indent=2)
|