#!/usr/bin/env python3 """对 index.html 做结构与约束自检""" from pathlib import Path import re html = Path('/data/workspace/index.html').read_text(encoding='utf-8') checks = [] # 1. 基础结构 checks.append(("DOCTYPE 声明", "" in html)) checks.append(("html lang=zh-CN", 'lang="zh-CN"' in html)) checks.append(("viewport 移动端", "viewport" in html)) checks.append(("title 非空", bool(re.search(r'(.+?)', html, re.S)))) checks.append(("keywords 非空", bool(re.search(r'name="keywords"[^>]*content="[^"]+', html)))) checks.append(("description 非空", bool(re.search(r'name="description"[^>]*content="[^"]+', html)))) # title 含更新时间 title_m = re.search(r'(.+?)', html, re.S) checks.append(("title 含 更新时间 格式", title_m and "(更新时间:2026-09-16 22:01:37)" in title_m.group(1))) checks.append(("title 优先马鞍山", title_m and title_m.group(1).startswith("安徽马鞍山"))) # 2. 无输入模块 checks.append(("无 form 表单", "" not in html.lower())) checks.append(("无 input", "]+src="([^"]+)"', html) provided = [ "http://cdn.qiancipai.com/Image26091610463149272c.jpg", "http://cdn.qiancipai.com/Image260916104631289d36.jpg", "http://cdn.qiancipai.com/Image260916104633007e22.jpg", "http://cdn.qiancipai.com/Image2609161046322893b3.jpg", "http://cdn.qiancipai.com/Image2609161046322732ee.jpg", "http://cdn.qiancipai.com/Image260916104632726db6.jpg", "http://cdn.qiancipai.com/Image2609161046318043d2.jpg", "http://cdn.qiancipai.com/Image260916104631257ad9.jpg", "http://cdn.qiancipai.com/Image260916115601596220.png", "http://cdn.qiancipai.com/Image26091611510265267f.png", ] allowed = set(provided) img_ok = all(src in allowed for src in imgs) checks.append(("图片全部来自提供清单(无自生成/替换)", img_ok)) checks.append(("去重图片 = 10 张全部使用", len(set(imgs)) == 10)) # Banner 用 115601596220.png checks.append(("Banner 使用指定Banner图", "Image260916115601596220.png" in html)) # 关于配图 checks.append(("关于我们使用指定配图", "Image26091611510265267f.png" in html)) # 4. Banner 宽高比 1920x1000 checks.append(("Banner aspect-ratio 1920/1000", "aspect-ratio: 1920 / 1000" in html)) # 5. 板块齐全 for sec, kid in [ ("首页Banner", 'class="banner"'), ("产品展示", 'id="products"'), ("关于我们", 'id="about"'), ("应用场景", 'id="scene"'), ("合作案例", 'id="cases"'), ("售后服务", 'id="service"'), ("FAQ", 'id="faq"'), ("城市分站入口", 'id="cities"'), ("友情链接", 'id="links"'), ]: checks.append((f"板块存在:{sec}", kid in html)) # 6. 响应式断点(7个) for bp in [1920, 1440, 1280, 1100, 1024, 768, 375]: checks.append((f"响应式断点 {bp}px", f"max-width: {bp}px" in html)) # 7. 资质证书(未提供资料 → 不写该部分) checks.append(("无资质证书板块(未提供资料)", 'id="qualification"' not in html and "资质证书" not in html)) # 8. 无 ICP 备案 checks.append(("无 ICP 备案信息", "ICP" not in html and "icp" not in html and "备案号" not in html)) # 9. 广告法:禁止绝对化用语 forbidden = ["最", "第一", "顶级", "全网最优", "国家级", "唯一", "极致"] bad = [w for w in forbidden if w in html] checks.append(("无绝对化用语(广告法)", len(bad) == 0)) # 10. 城市分站 & 友情链接完整性 for url in [ "https://rtpnu.zhfmgc.com", "https://xotim.836188.com", "https://xzjnn.szbla.com", "https://ztsyk.9c3c.com", "https://aodnb.layouwei.com", "https://hjghd.szbla.com", "https://tavop.buhuihua.com", "https://llbko.wggjl.com", "https://znrhg.szbla.com", "https://rfccx.zhfmgc.com", ]: checks.append((f"城市分站链接 {url.split('//')[1]}", url in html)) for url in [ "https://lgnbw.wggjl.com", "https://xgnvu.szbla.com", "https://hpesv.9c3c.com", "https://ajels.773588.com", "https://ivdhl.jntfw.com", "https://nigvf.aixixin.com", "https://llosg.836188.com", "https://xtlvu.aixixin.com", "https://mxjom.bfcmgg.com", "https://doypi.wggjl.com", ]: checks.append((f"友情链接 {url.split('//')[1]}", url in html)) # 公司信息 for info in ["鑫久正节能", "董先生", "18515896788", "安徽马鞍山"]: checks.append((f"公司信息含「{info}」", info in html)) # 产品关键词覆盖 kw = ["工业窑炉陶瓷纤维垫片", "燃气设备陶瓷纤维垫片", "陶瓷纤维方形垫片", "法兰耐高温垫片", "蒸汽管道垫片", "坩埚升液管法兰垫片", "陶瓷纤维密封垫片", "柔性耐高温垫片"] for k in kw: checks.append((f"产品关键词「{k}」", k in html)) print("=" * 70) ok = 0 for name, res in checks: print(f" [{'✓' if res else '✗'}] {name}") ok += res print("=" * 70) print(f"通过: {ok}/{len(checks)}")