File size: 775 Bytes
8ad2128 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import json
import re
import traceback
try:
with open(r'C:\Users\KIIT0001\.gemini\antigravity\brain\11fe738c-0bc1-48e6-88bd-c54041a22f85\.system_generated\logs\overview.txt', 'r', encoding='utf-8') as f:
content = f.read()
match = re.search(r'in this the first link is this\s*(\[\s*\{\s*"entity_id".*?\}\s*\])', content, re.DOTALL | re.IGNORECASE)
if match:
json_str = match.group(1)
data = json.loads(json_str)
with open('c:/Users/KIIT0001/shl_ass/catalog.json', 'w', encoding='utf-8') as out:
json.dump(data, out, indent=2)
print(f'Saved catalog.json with {len(data)} items.')
else:
print('Could not find JSON in logs.')
except Exception as e:
print(f'Error: {e}')
traceback.print_exc()
|