import re
from collections import defaultdict
h = open('index_main.html', encoding='utf-8').read()
m = re.search(r'const PROGRAMS=(\[.*?\]);', h, re.DOTALL)
arr = m.group(1)
items = re.findall(r'\{id:"([^"]+)",s:"([^"]+)",n:"([^"]+)"', arr)
byschool = defaultdict(list)
for i, s, n in items:
    byschool[s].append((i, n))
for s in ['duke', 'cmu', 'col', 'umich', 'emory', 'geo', 'vanderbilt', 'notre', 'uva', 'brown']:
    print(f'=== {s} ({len(byschool[s])}) ===')
    for i, n in byschool[s]:
        print(f'  {i}: {n}')
