# -*- coding: utf-8 -*-
import io, json, re
h = io.open("index_main.html", encoding="utf-8", newline="").read()
seg = h[h.index("const PROGRAMS=["):h.index("const CATD=[")]
phd = len(re.findall(r'lvl:"d"', seg))
master = len(re.findall(r'lvl:"m"', seg))
b = json.load(io.open("_heartbeat_baseline.json", encoding="utf-8"))
b["phd"] = phd
b["master"] = master
b["vd"] = 1587
io.open("_heartbeat_baseline.json", "w", encoding="utf-8").write(json.dumps(b, ensure_ascii=False, indent=1))
print("phd", phd, "master", master, "vd", b["vd"], "round", b["round"])
