# -*- coding: utf-8 -*-
import io, sys, os, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
b=open("_33_harvard-engineering-and-applied-sciences.html","rb").read()
t=html.unescape(re.sub(r"<script[\s\S]*?</script>|<style[\s\S]*?</style>"," ",b.decode("utf-8","ignore")))
t=re.sub(r"\s+"," ",re.sub(r"<[^>]+>"," ",t))
# 找正文：Second time 出现 Engineering and Applied Sciences
idxs=[m.start() for m in re.finditer(r"Engineering and Applied Sciences",t)]
print("hits",idxs)
for i in idxs[-3:]:
    print("---",i,"---")
    print(t[i:i+1200])
