Install
openclaw skills install free-smart-web-search智能联网搜索工具,国内外自动切换引擎,Query 意图优化,双层内容抓取,适合中文和英文查询
openclaw skills install free-smart-web-search智能联网搜索工具,整合多项优化能力:
基于搜索意图自动优化关键词,提升结果相关性:
| 输入示例 | 改写后 | 说明 |
|---|---|---|
| 深圳有什么好玩的 | 深圳 景点 | 城市游玩查询 |
| 深圳美食 | 深圳 美食推荐 | 城市美食查询 |
| 今日金价 | 金价 | 去掉模糊时间词 |
| Python 是什么 | Python 介绍 | 知识类查询 |
| Python 教程 | Python 教程 | 教程类(标准化) |
| 怎么做蛋糕 | 蛋糕 做法 | 方法类查询 |
| xxx 怎么样 | xxx 评价 | 评价类查询 |
| xxx 靠谱吗 | xxx 评价 | 评价类查询 |
| A和B哪个好 | A B 对比 | 对比类查询 |
| Python vs Java | Python Java 对比 | VS对比查询 |
| xxx 下载 | xxx 官方下载 | 下载类查询 |
| xxx 官网 | xxx 官网 | 官网查询 |
| 最新xxx消息 | xxx 最新 | 资讯类查询 |
可通过 --no-rewrite 跳过改写。
搜索后自动抓取前 N 条 URL 的正文内容:
可选参数 --filter,自动过滤:
# 基础搜索(自动检测区域,抓取前3条正文)
node scripts/search.js "Claude Code 教程"
# 指定区域
node scripts/search.js "最新科技新闻" --region=cn
# 只搜索不抓正文
node scripts/search.js "React hooks" --no-fetch
# 过滤低质量域名
node scripts/search.js "编程入门" --filter
# 跳过 Query 改写
node scripts/search.js "今日金价" --no-rewrite
# 抓取前5条正文
node scripts/search.js "AI 发展趋势" --fetch=5
# 最多返回20条结果
node scripts/search.js "开源项目" --max=20
cd smart-web-search
bash scripts/setup.sh # Linux/macOS
Windows PowerShell:
cd smart-web-search
npm install
npx playwright install chromium
| 依赖 | 用途 | 大小 | 必需 |
|---|---|---|---|
| Node.js >= 18 | 运行时 | - | ✅ |
| cheerio | HTML 解析 | 小 | ✅ |
| commander | CLI 参数 | 小 | ✅ |
| iconv-lite | GBK 编码 | 小 | ✅ |
| playwright | 正文抓取(仅 fetch.js 使用) | 50MB | ✅ |
| Chromium | Playwright 浏览器(仅正文抓取兜底) | 150MB | ✅ |
说明:
--no-fetch(不抓正文),可以不安装 Chromium国内用户安装时自动使用镜像源加速。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
query | string | - | 搜索关键词(必填) |
--max | integer | 10 | 最大结果数(1-30) |
--region | string | auto | 区域:auto/cn/intl |
--fetch | integer | 3 | 抓取前N条正文(0=不抓) |
--max-len | integer | 6000 | 单页最大字符数 |
--no-fetch | flag | - | 禁用正文抓取 |
--filter | flag | - | 过滤低质量域名 |
--no-rewrite | flag | - | 跳过 Query 改写 |
--region=cn/intl区域检测(三轮并行探测,3秒超时)
↓
Query 改写(意图识别规则,可选)
↓
搜索引擎(纯 HTTP,无浏览器)
- 国内: Bing HTML (cn.bing.com)
- 海外: DDG HTML (html.duckduckgo.com)
↓
去重(域名+路径主干) + 域名过滤(可选)
↓
正文抓取(默认前3条)
- 第1层: HTTP + cheerio(秒出,JSON-LD/Next.js 数据提取)
- 第2层: Playwright headed 兜底(处理 JS 渲染页面)
↓
返回 JSON 结果(title, url, snippet, content)
性能优化:
| 特性 | smart-web-search | free-web-search-js | free-web-search (Python) |
|---|---|---|---|
| 运行时 | Node.js | Node.js | Python 3 |
| 搜索架构 | 纯 HTTP | Playwright headless | Playwright headless |
| 区域检测 | ✅ 三轮并行 | ✅ 三轮并行 | ❌ 固定国内 |
| Query 改写 | ✅ 7条规则 | ❌ 无 | ✅ 7条规则 |
| 域名过滤 | ✅ 可选 | ❌ 无 | ✅ 可选 |
| 正文抓取 | ✅ HTTP → PW 两层 | ✅ HTTP → PW 两层 | ❌ 单层 PW |
| headless 问题 | ✅ 无(搜索用 HTTP) | ⚠️ 有(Bing 可能检测) | ⚠️ 有 |
| 速度 | ⚡ 极快(<3s) | 🟡 慢(需启动浏览器) | 🟡 慢 |
推荐使用场景:
与 Claude Code 内置 WebFetch 的关系:
cd smart-web-search
node scripts/search.js "测试搜索" --max=2 --no-fetch
成功返回 JSON 数组即可。