# -*- coding: utf-8 -*-
import re, io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
h = open('index_main.html', encoding='utf-8').read()
mp = re.search(r'const PROGRAMS\s*=\s*\[(.*?)\];', h, re.S)
recs = re.findall(r'\{id:"([^"]+)"([\s\S]*?)(?=\{id:"|$)', mp.group(1))
by = {r[0]: r[1] for r in recs}
vd = set(re.findall(r'details/[^"]+\.html', h))
ids = ["mcg-ece-phd","uw-ece-phd","nu-ece-phd","rice-ece-phd","vanderbilt-ece-phd",
       "wustl-ee-phd","notre-ee-phd","ucsd-cse-bioinfo-phd"]
for i in ids:
    b = by[i]
    n = re.search(r'n:"([^"]*)"', b).group(1)
    url = re.search(r'url:"([^"]*)"', b).group(1)
    print(i, "|", n, "|", url, "| VD:", url in vd, "| disk:", os.path.exists(url))
