# -*- coding: utf-8 -*-
import re, io, sys, collections
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
html = open('index_main.html', encoding='utf-8').read()
m = re.search(r'const PROGRAMS=\[([\s\S]*?)\];\s*\n', html)
seg = m.group(1)
deg = re.findall(r'deg:"([^"]*)"', seg)
c = collections.Counter(deg)
for k, v in sorted(c.items(), key=lambda x: -x[1]):
    print(repr(k), v)
print('total', len(deg))
