Skip to content

Instantly share code, notes, and snippets.

@squaresmile
Created May 20, 2020 02:20
Show Gist options
  • Save squaresmile/0c16c459c2a9164e7e9456ace28f01a5 to your computer and use it in GitHub Desktop.
Save squaresmile/0c16c459c2a9164e7e9456ace28f01a5 to your computer and use it in GitHub Desktop.
A small script to extract fgo master data from kazemai
import lzstring
import requests
KAZEMAI_DATA = "https://kazemai.github.io/fgo-vz/common/js/master.js"
print("Downloading master.js")
r = requests.get(KAZEMAI_DATA)
master_data = r.text.splitlines()[0][65:-4]
with open("master.txt", "w", encoding="utf-8") as fp:
fp.write(master_data)
master_bytes = bytes.fromhex(master_data)
master_string = ""
for i in range(len(master_bytes) // 2):
master_string += chr(master_bytes[i * 2] | master_bytes[i * 2 + 1] << 8)
print("LZString decompress")
lz_string = lzstring.LZString()
mstTxt = lz_string.decompress(master_string)
with open("kazemai.json", "w", encoding="utf-8") as fp:
fp.write(mstTxt)
@squaresmile
Copy link
Author

Browse the data here https://fgo.square.ovh/kazemai/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment