# -*- coding: utf-8 -*-
import io, re, glob, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
f = glob.glob("cache/r349-rady-ucsd-edu-programs-master-quantitative-finance-career*")[0]
s = io.open(f, encoding="utf-8", errors="ignore").read()
ms = re.findall(r'label:\s*"([^"]+)",\s*pct:\s*([0-9.]+)', s)
print(len(ms), ms[:20])
for kw in ["topRoles", "salary", "median", "Employment"]:
    for m in list(re.finditer(kw, s))[:2]:
        print("--", kw, "|", re.sub(r"\s+", " ", s[max(0, m.start()-150):m.start()+260]))
