import re
h = open('index_main.html', encoding='utf-8').read()
m = re.search(r'const PROGRAMS\s*=\s*\[', h)
s = m.end()
d = 1
i = s
in_s = False
sc = ''
while i < len(h) and d > 0:
    c = h[i]
    if in_s:
        if c == '\\':
            i += 2
            continue
        if c == sc:
            in_s = False
    else:
        if c in ('"', "'"):
            in_s = True
            sc = c
        elif c == '[':
            d += 1
        elif c == ']':
            d -= 1
    i += 1
block = h[s:i-1]
recs = re.split(r'(?=\{id:")', block)
for sch in ['berkeley', 'princeton', 'dartmouth', 'harvard', 'mcg', 'ubc', 'mit', 'brown', 'yale', 'rice']:
    print(f'=== {sch} ===')
    for r in recs:
        mm = re.search(r'\{id:"([^"]+)",s:"([^"]+)",n:"([^"]+)"', r)
        if mm and mm.group(2) == sch:
            print(f'  {mm.group(1):45s} | {mm.group(3)[:70]}')
