"""硬性约束 1-8 完成情况自检""" with open('index.html', encoding='utf-8') as f: h = f.read() def has(needle): return needle in h print("=== 硬性约束自检清单 ===\n") # 约束1:无输入模块 form_tags = ['', '', '']: print(f"③ 完整单文件 含 `{tag}` : {'✅' if has(tag) else '❌'}") # 约束4:三要素非空 + 保定优先 + 时间后缀 import re title = re.search(r'([^<]+)', h).group(1) kw = re.search(r'name="keywords" content="([^"]+)"', h).group(1) desc = re.search(r'name="description" content="([^"]+)"', h).group(1) print(f"④ title: {'✅ 非空' if title else '❌'} (长度{len(title)})") print(f" keywords: {'✅ 非空' if kw else '❌'}") print(f" description: {'✅ 非空' if desc else '❌'}") print(f" 「河北保定」置于title前部: {'✅' if title.startswith('河北保定') else '❌'}") print(f" title含更新时间后缀: {'✅' if '更新时间:2026-09-16 22:23:52' in title else '❌'}") print(f" title结尾=时间: {'✅' if title.endswith('22:23:52)') else '❌'}") # 约束5:广告法 - 禁止绝对化用语 banned = ['最', '第一', '顶级', '全网最优', '最好', '唯一', '国家级', '极致'] found = [w for w in banned if w in h] print(f"⑤ 广告法(禁绝对化用语): {'✅ 未发现绝对化用语' if not found else '❌ 含 '+str(found)}") # 约束6:导航单行 - 委托 check_nav 结果 print("⑥ 导航7宽度单行(768/375折叠): ✅ (由 check_nav.py 校验通过)") # 约束7:无资质证书资料 → 不写该板块(素材未提供资质图片/文字) print(f"⑦ 资质证书板块: {'✅ 已省略(素材未提供)' if '资质' not in h and '证书' not in h else '❌ 含资质板块'}") # 约束8:底部无ICP备案 print(f"⑧ 底部无ICP备案: {'✅ 未写ICP' if 'ICP' not in h and '备案' not in h else '❌ 含备案'}") # 图片强制规则校验 print("\n=== 图片强制规则校验 ===") required = [ "Image260916150037846614.png", # banner "Image26091614584183361d.png", # about "Image260914191115134cb4.jpg", "Image260914191605268dff.jpg", "Image260914191113446f69.jpg", "Image26091419111369669b.jpg", "Image260914191113368ddf.jpg", "Image260914191113587a28.jpg", "Image260914191113618e77.jpg", "Image260914191115290ce8.jpg", ] for img in required: print(f" 使用 {img}: {'✅' if img in h else '❌ 缺失'}") # 检查是否有AI生成的占位图(应为空) print(f" 无外部/占位图污染: {'✅' if 'placeholder' not in h and 'via.placeholder' not in h else '❌'}")