import re
html = open('index_main.html', encoding='utf-8').read()
# 用更宽松的方式搜 UCSD 已落库项目
ucsd_all = re.findall(r'\{id:"(ucsd-[^"]+)"[^}]*?en:"([^"]+)"', html)
print(f'UCSD 已落库（宽松匹配）: {len(ucsd_all)}')
for did, en in ucsd_all:
    print(f'  {did}  |  {en[:80]}')

print()
# 检查目标 PhD 是否已落库
targets = ['bioengineering', 'bioinformatics', 'biomedical', 'biochemistry', 'astronomy', 'aerospace', 'mechanic', 'electrical', 'computer', 'data science', 'statistics', 'physics', 'chemistry', 'mathematics', 'ocean', 'earth', 'climate']
print('=== 搜索目标关键词是否已在 UCSD 落库 ===')
for kw in targets:
    found = [en for did, en in ucsd_all if kw in en.lower()]
    if found:
        print(f'  [{kw}] FOUND: {found[0][:80]}')
    else:
        print(f'  [{kw}] NOT FOUND')
