User:JohnnyTOS/Stage Data Extraction/script.py



import urllib.parse, json import xml.etree.ElementTree as ET

tree = ET.parse('com.madhead.tos.zh.v2.playerprefs.xml') root = tree.getroot

for child in root: if child.attrib['name'] == 'MH_CACHE_RUNTIME_DATA_CURRENT_FLOOR_ENTER_DATA': content = urllib.parse.unquote(child.text) content_json = json.loads(content[content.find('{'):])

with open('stage_info.txt', 'w', encoding ='utf-8') as outfile: json.dump(content_json, outfile, indent=4, ensure_ascii=False)