import re, sys, glob, json, html out = [] for f in sorted(glob.glob(sys.argv[1] + '/*.html')): h = open(f, encoding='utf-8').read() for blk in re.split(r'

', h)[1:]: d = re.match(r'([^<]+)', blk).group(1) blk = blk.split('
')[0] for url, t in re.findall(r'
  • ([^<]+)
  • ', blk): out.append({'date': d, 'title': html.unescape(t), 'url': url}) json.dump(out, open(sys.argv[2], 'w'), indent=1, ensure_ascii=False) for o in out: print(o['date'], '|', o['title'], '|', o['url'].split('.com/')[1]) print(len(out))