wynnbuilder-forked-for-changes/py_script/dump.py

23 lines
731 B
Python
Raw Normal View History

2021-01-06 06:10:27 +00:00
import requests
import json
2021-06-20 07:20:38 +00:00
import numpy as np
2021-01-06 06:10:27 +00:00
response = requests.get("https://api.wynncraft.com/public_api.php?action=itemDB&category=all")
with open("dump.json", "w") as outfile:
2021-01-06 08:40:51 +00:00
outfile.write(json.dumps(response.json()))
2021-06-20 07:20:38 +00:00
arr = np.array([])
for i in range(4):
response = requests.get("https://api.wynncraft.com/v2/ingredient/search/tier/" + str(i))
arr = np.append(arr, np.array(response.json()['data']))
with open("../ingreds.json", "w") as outfile:
outfile.write(json.dumps(list(arr)))
with open("../ingreds_compress.json", "w") as outfile:
outfile.write(json.dumps(list(arr)))
with open("../ingreds_clean.json", "w") as outfile:
json.dump(list(arr), outfile, indent = 2) #needs further cleaning