# -*- coding: utf-8 -*-
import io, re
html = io.open('index_main.html', encoding='utf-8').read()
i0 = html.index('const PROGRAMS=[')
i1 = html.index('const CATD=[')
seg = html[i0:i1]
ids = ['notre-msae','notre-msce','notre-msenve','notre-cee-meng','notre-mse-phd','notre-bme-phd','notre-physics-phd','notre-chem-phd']
for pid in ids:
    marker = '{id:"' + pid + '"'
    i = seg.index(marker)
    nxt = seg.find('{id:"', i + len(marker))
    if nxt < 0: nxt = len(seg)
    blk = seg[i:nxt]
    print('=' * 10, pid)
    for k in ('ddl','lang','test','tui','dur','deg'):
        m = re.search(r'(?<![A-Za-z])' + k + r':"((?:[^"\\]|\\.)*)"', blk)
        print(' ', k, '=', m.group(1) if m else None)
