# -*- coding: utf-8 -*-
import re, io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
h = open('index_main.html', encoding='utf-8').read()
p0 = h.index("const PROGRAMS=["); p1 = h.index("const CATD=[")
seg = h[p0:p1]
for pid in ['up-mcit','up-ds','up-ee','up-cis']:
    m = re.search(r'\{id:"'+re.escape(pid)+r'"[\s\S]*?(?=\{id:"|,?\n\];)', seg)
    if m:
        print('====', pid)
        print(m.group(0))
        print()
