闲社服务运行正常AI智能体自动化平台
g

谷歌索引检查

技能标识:google-index-checker

Check Google indexed page count for any domain using the "site:" search operator in Chrome Remote Debugging Protocol (CDP on localhost:9222). Use when the user wants to check how many pages Google has indexed for a website, compare indexing across multiple domains, or monitor SEO indexing status. Supports single or multiple domains with comparison table output.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.1.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

谷歌索引检查

Google索引检查器

通过Chrome远程调试协议(CDP)在localhost:9222上使用Google的site:搜索运算符,检查任意域名的已索引页面数量。

前提条件

  • - Chrome以--remote-debugging-port=9222参数运行
  • Node.js的ws npm包位于/tmp/wsclient/node_modules/ws
- 一次性安装:npm install ws --prefix /tmp/wsclient - 如果未找到,请在启动前安装

连接信息

  • - CDP HTTP端点:http://localhost:9222/json
  • 重要提示:使用localhost:9222,而非127.0.0.1:9222——Chrome监听IPv6 ::1,而非IPv4 127.0.0.1
  • 所有浏览器标签页共享相同的cookie/登录会话(同一Chrome配置文件)
  • 每次任务完成后,关闭所有标签页并清理/tmp/wsclient

操作说明

步骤1:解析用户输入

提取要检查的域名。支持:

  • - 单个:example.com、www.example.com、https://example.com
  • 多个:逗号分隔、空格分隔或逐行输入
  • 标准化:去除协议和尾部斜杠

步骤2:准备浏览器连接

  1. 1. 如需要则安装ws:npm install ws --prefix /tmp/wsclient
  2. 创建一个CDP标签页:PUT http://localhost:9222/json/new
  3. 保存响应中的webSocketDebuggerUrl

步骤3:查询每个域名(复用同一标签页)

对每个域名,在同一标签页中使用Page.navigate(不要创建新标签页):

  1. 1. Page.navigate → https://www.google.com/search?q=site:{domain}
  2. 等待Page.loadEventFired + 3秒
  3. Runtime.evaluate → document.getElementById(result-stats)?.textContent
  4. 使用正则表达式/找到约 ([\d,]+) 条结果/从类似找到约 12,700 条结果的文本中解析计数
  5. 去除逗号 → 整数

步骤4:呈现结果

单个域名

{domain} 约有 {count} 个页面被Google索引。

多个域名

markdown

Google索引覆盖报告({date})

域名已索引页面数备注
example.com13,200—
example.org
8,500 | — | | example.net | 1,200 | — |

数据来源:Google site: 搜索运算符(近似值)

步骤5:清理

  1. 1. 关闭标签页:DELETE http://localhost:9222/json/close/{targetId}
  2. 验证:GET http://localhost:9222/json应返回[]
  3. 删除临时包:rm -rf /tmp/wsclient

CDN脚本模板(可直接复制使用)

javascript
const WebSocket = require(/tmp/wsclient/node_modules/ws);
const http = require(http);

function cdpSend(ws, id, method, params) {
return new Promise(resolve => {
const handler = data => {
const msg = JSON.parse(data);
if (msg.id === id) resolve(msg);
};
ws.on(message, handler);
ws.send(JSON.stringify({id, method, params}));
});
}

function extractCount(text) {
if (!text) return NOT_FOUND;
const m = text.match(/找到约 ([\d,]+) 条结果/);
return m ? m[1].replace(/,/g, ) : PARSE_ERROR: + text;
}

async function main() {
// 1. 创建一个标签页
const target = await new Promise((resolve, reject) => {
const req = http.request({hostname: localhost, port: 9222, path: /json/new, method: PUT}, res => {
let d = ; res.on(data, c => d += c); res.on(end, () => resolve(JSON.parse(d)));
});
req.on(error, reject); req.end();
});

// 2. 连接WebSocket
const ws = new WebSocket(target.webSocketDebuggerUrl);
await new Promise(r => ws.on(open, r));
await cdpSend(ws, 1, Page.enable, {});
await cdpSend(ws, 2, Runtime.enable, {});

// 3. 循环处理域名
const domains = [[Name, example.com]]; // 替换为实际域名
for (const [name, domain] of domains) {
await cdpSend(ws, 10, Page.navigate, {url: https://www.google.com/search?q=site: + domain});
await new Promise(resolve => {
ws.on(message, data => {
const msg = JSON.parse(data);
if (msg.method === Page.loadEventFired) resolve();
});
});
await new Promise(r => setTimeout(r, 3000));
const r = await cdpSend(ws, 11, Runtime.evaluate, {expression: document.getElementById(result-stats)?.textContent || NOT_FOUND});
console.log(name + | + domain + | + extractCount(r.result.result.value));
}

// 4. 清理
ws.close();
http.request({hostname: localhost, port: 9222, path: /json/close/ + target.id, method: DELETE}, () => {}).end();
await new Promise(r => setTimeout(r, 1000));

// 5. 验证标签页已关闭
const remaining = await new Promise((resolve, reject) => {
const req = http.request({hostname: localhost, port: 9222, path: /json, method: GET}, res => {
let d = ; res.on(data, c => d += c); res.on(end, () => resolve(JSON.parse(d)));
});
req.on(error, reject); req.end();
});
console.log(剩余标签页数:, remaining.length);
process.exit(0);
}

main().catch(e => { console.error(e); process.exit(1); });

边界情况

问题解决方案
未找到#result-stats尝试div[id^=result]或document.body.innerText
Google验证码
截取屏幕截图,停止操作,报告给用户 | | 0条结果 | 检查网站是否为新站或被robots.txt屏蔽 | | localhost:9222返回404 | Chrome未以--remote-debugging-port=9222参数启动 | | 标签页累积 | 使用后始终关闭标签页,通过GET /json验证 |

重要说明

  • - site:运算符返回的是近似值,而非精确计数
  • 不同Google数据中心的结果可能有所不同
  • 如需精确数据,请使用Google Search Console
  • 一个标签页,顺序导航——不要为每个域名创建新标签页

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 google-index-checker-1775983081 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 google-index-checker-1775983081 技能

通过命令行安装

skillhub install google-index-checker-1775983081

下载

⬇ 下载 google-index-checker v1.1.0(免费)

文件大小: 3.18 KB | 发布时间: 2026-4-13 10:28

v1.1.0 最新 2026-4-13 10:28
v1.1.0: Fix connection address (localhost not 127.0.0.1), add tab reuse pattern (Page.navigate in same tab), full CDP script template, cleanup steps, edge case handling. Prerequisites now include ws npm package.
返回顶部