extract.py
· 700 B · Python
Raw
#generated by chatgpt
import vdf
def extract_launch_options(filepath):
with open(filepath, 'r', encoding='utf-8') as f:
data = vdf.load(f)
results = []
def walk(node):
for key, val in node.items():
if isinstance(val, dict):
if key.isdigit() and "LaunchOptions" in val:
print(f"[{key}] {val['LaunchOptions']}")
walk(val)
walk(data)
return results
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser("extract")
parser.add_argument("filepath", help="the path to the VDF file to extract")
args = parser.parse_args()
extract_launch_options(args.filepath)
| 1 | #generated by chatgpt |
| 2 | import vdf |
| 3 | |
| 4 | def extract_launch_options(filepath): |
| 5 | with open(filepath, 'r', encoding='utf-8') as f: |
| 6 | data = vdf.load(f) |
| 7 | |
| 8 | results = [] |
| 9 | |
| 10 | def walk(node): |
| 11 | for key, val in node.items(): |
| 12 | if isinstance(val, dict): |
| 13 | if key.isdigit() and "LaunchOptions" in val: |
| 14 | print(f"[{key}] {val['LaunchOptions']}") |
| 15 | walk(val) |
| 16 | |
| 17 | walk(data) |
| 18 | return results |
| 19 | |
| 20 | if __name__ == "__main__": |
| 21 | import argparse |
| 22 | |
| 23 | parser = argparse.ArgumentParser("extract") |
| 24 | parser.add_argument("filepath", help="the path to the VDF file to extract") |
| 25 | args = parser.parse_args() |
| 26 | |
| 27 | extract_launch_options(args.filepath) |