import json, os
base = os.path.dirname(__file__)
files = ["extractly_sourcemanual.json","extractly_sourcemanuLocal.json"]
for fname in files:
    path = os.path.join(base, fname)
    if not os.path.exists(path):
        print('Missing', path)
        continue
    with open(path,'r',encoding='utf-8') as f:
        data = json.load(f)
    new = []
    for obj in data:
        new.append({'title': obj.get('title'), 'selectors': obj.get('selectors')})
    with open(path,'w',encoding='utf-8') as f:
        json.dump(new,f,ensure_ascii=False,indent=2)
    print(f'Updated {path} -> {len(new)} rows')
