import json import os _data_path = os.path.join(os.path.dirname(__file__), 'sample_data.json') with open(_data_path, 'r', encoding='utf-8') as f: SCRIPTS = json.load(f) BUILTIN_SCRIPTS = SCRIPTS def get_script_by_id(script_id: str) -> dict | None: for s in SCRIPTS: if s.get("id") == script_id: return s return None def get_script_by_title(title: str) -> dict | None: for s in SCRIPTS: if s["title"] == title: return s return None