关于 seo-crawl-render
seo-crawl-render 是面向 Claude Code 的技能,可将网页采集并解析为 PageSnapshot v2。它根据页面信号选择渲染方式,并支持单页或多页脚本。
主要功能
- 01单页与多页采集
- 02静态和 JavaScript 渲染选项
- 03解析页面并生成站点产物
- 04输出精简的运行摘要
适用场景
- 01审计页面响应头和状态码
- 02按采样及 robots 规则抓取站点
- 03为 SEO 审计模块提供快照
MCP 相关
它可接收由 Playwright 或 Firecrawl MCP 捕获的渲染 DOM 文件,将外部渲染内容纳入快照。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ hainrixz/ claude-seo-ai --skill seo-crawl-render安装后在 Claude Code 中输入/seo-crawl-render确认已加载。
详细介绍
seo-crawl-render
生成供所有模块使用的 PageSnapshot(v2)。脚本负责抓取、解析、渲染和持久化;此技能负责决定运行哪个命令,并且仅读取精简的标准输出摘要。Claude Code 的 WebFetch 返回的是有损的模型摘要,不包含标头、状态码或原始 HTML,也不会跟随跨主机重定向,因此绝不会用作获取数据的途径。
获取数据
- 单个页面或本地路径:
node "${CLAUDE_PLUGIN_ROOT}/scripts/snapshot.mjs" <url|path> --out "${CLAUDE_PLUGIN_DATA}/runs" [--render auto|static|js] [--ua default|googlebot|bingbot|gptbot|oai-searchbot|claude-searchbot] [--renderer auto|chrome|playwright|none] [--rendered-file <dom.html>] [--max-bytes 5000000] [--json]— 非默认的--ua会写入pages/<slug>.ua-<preset>.json。 - 多页面:
node "${CLAUDE_PLUGIN_ROOT}/scripts/crawl.mjs" <url> [--pages 12] [--max 40] [--per-template 2] [--depth 3] --out "${CLAUDE_PLUGIN_DATA}/runs"— 始终包含首页和目标页面,然后每种检测到的模板最多抓取--per-template个页面;遵守 robots 规则;每次跳过都会记录在crawl.json.sampling中。还支持--concurrency、--delay、--include/--exclude、--seeds、--sitemap-sample、--link-status和--no-robots。 - 只读取标准输出摘要(运行目录、slug、计数、渲染判定、警告)。绝不要将 HTML 粘贴到对话中——模块会读取
pages/<slug>.json,并通过Grep搜索pages/<slug>.html。 - 本地目录会作为已构建的 HTML 读取(
status: null,标头为空)。没有已构建输出的框架源代码会以状态码 2 退出:请先构建,或提供已部署的 URL。
渲染判定(由脚本负责)
--render auto 会在字数少于 150、页面仍然内容单薄且包含 hydration 标记(__NEXT_DATA__、__NUXT_DATA__、self.__next_f、空的 #app/#__next 根节点)、没有 h1 且锚点少于 3 个,或存在 <noscript> JS 提示时,将渲染标记为必需。--render static 从不渲染;--render js 始终尝试渲染。默认值因入口点而异:snapshot.mjs 默认为 auto,而 crawl.mjs 和 audit.mjs 默认为 static——无头或多页面运行不会启动浏览器,除非明确要求启动。
--renderer auto(默认值)会自动检测无头 Chrome/Chromium/Edge/Brave(依次检查$CLAUDE_SEO_AI_CHROME→$CHROME_PATH→$PUPPETEER_EXECUTABLE_PATH→ PATH → 默认应用路径 → Playwright 缓存);--renderer playwright为可选项,仅在已安装时使用——绝不自动安装;--renderer none会完全禁用渲染;--rendered-file <html>接受由 Playwright/Firecrawl MCP 或用户捕获的 DOM。- 当
render.needed && render.used === "none"时:快照会附带confidence: reduced和render.hint;将M4.render.not_rendered作为needs_api发出(严重程度为 3,轴为both,fixable: advisory),并引用该提示(“安装 Chrome,或传入来自渲染 MCP 的--rendered-file”)。绝不要假装看过渲染后的内容。
PageSnapshot v2 — <run_dir>/pages/<slug>.json
{ target: {kind: "url"|"path", value}, request: {ua, accept_language, timeout_ms},
status_chain: [{url, status, location, ms}], redirects: {http_to_https, host_changed, www_normalized, trailing_slash_changed, hops},
headers: {…}, // final response; set-cookie → cookie names only
robots_directives: {header, meta: [], effective},
body: {bytes, truncated, charset, sha256}, timing: {ttfb_ms, download_ms},
raw_html_path, rendered_html_path, // files beside the JSON; rendered is null when not rendered
render: {needed, signals: [], used: "chrome"|"playwright"|"external"|"none", confidence: "high"|"reduced", available: [], hint, delta},
parsed: {…}, parsed_rendered: {…}|null, // parseDocument(): title, metas, robots_meta, canonicals, hreflang, anchors, headings, images, scripts, jsonld, landmarks, markers, word_count, text_sample …
site: {robots: "site/robots.json", sitemaps: "site/sitemaps.json", discovery: "site/discovery.json"},
tier: 0|1|2 }
每次运行都会构建一次站点产物:site/robots.json(已解析的 REP 和各机器人判定)、site/sitemaps.json(索引 BFS、gzip、lastmod 统计)以及 site/sitemap-urls.txt、site/discovery.json(对 /llms.txt、/llms-full.txt、/agents.md、/.well-known/ucp、/.well-known/ai-catalog.json、/sitemap_agentic_discovery.xml、/api/ucp/mcp 的探测,以及 http:// → HTTPS 强制跳转)。
层级
- 0 — 脚本:真实状态链、标头、原始 HTML、已解析文档、站点产物。每次审计都会到达此层;不渲染,不含字段数据。
- 1 — 加上渲染器和/或 PSI:自动检测的无头 Chrome 或可选的 Playwright(或
--rendered-file),和/或用于字段 CWV 的 PageSpeed Insights 密钥。 - 2 — 加上账户数据:Search Console / Merchant Center 访问权限,以及手动导出的 Search Console 生成式 AI 数据。
当某项发现所需层级高于快照的
tier时,模块会将其标记为needs_api,绝不会静默判定通过。