Install
openclaw skills install mayf3-smart-searchMulti-engine search with auto-fallback, result parsing, and quality scoring via DDGS local library. Use when: searching the web, gathering information, market research, tech lookup, news search, fact checking. Triggers on 'search', '搜索', 'find info', 'look up', '调研', '查一下'. Not for: browser automation searches, internal file search, code search within repos.
openclaw skills install mayf3-smart-search多引擎搜索集成:DDGS 本地库优先,自动语言检测,自动降级,结构化结果,搜索→提取一体化。
extract() 获取全文)--timeout 线程安全,--type all 可用)唯一必记规则: 用 --fallback,脚本会自动根据查询语言选择最优后端链(中文→bing优先,英文→brave优先)。需要全文时加 --extract。需要强制指定语言时用 --lang en/cn。脚本化调用时用 --urls-only 只输出 URL。
| 后端 | 速度 | 适用场景 | 状态 |
|---|---|---|---|
| brave | ~1.1-1.7s | 英文首选 | ✅ 稳定 |
| bing | ~1.5s | 中文首选 | ✅ 稳定 |
| yandex | ~1.4s | 中文备选 | ⚠️ EN 搜索有时失败 |
| yahoo | ~1.1s | 备选 | ✅ 稳定 |
DDGS 返回结构化 JSON(title/href/body),无需手动解析 HTML。
extract()方法可直接获取 URL 全文 markdown(~0.5s),搜索→提取一站式。 ⚠️ brave 短时间连续搜索(>4次)可能返回空结果,切换到 yandex/yahoo。 ⚠️threads()是 DDGS 类变量(控制并发线程数),不是搜索方法,不可调用。
| 引擎 | 响应时间 | 适用场景 |
|---|---|---|
| Bing CN | ~500ms | 降级首选,通用搜索 |
| 360 | ~1200ms | 英文搜索意外好 |
| Sogou | ~1800ms | 微信内容,长文搜索 |
DuckDuckGo、Brave Search、Google、百度 — web_fetch 被反爬拦截,但 DDGS 库可通过 brave/bing 后端获取结果。
# 通用搜索(自动检测语言)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "搜索关键词" --fallback -m 5
# 版本信息
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --version
# 强制指定语言(覆盖自动检测)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI agent" --lang cn --fallback # 强制中文链
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "人工智能" --lang en --fallback # 强制英文链
# 指定后端 + JSON 输出
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" -b brave -o json
# 搜索类型:text/news/videos/images/books
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI news" --type news --fallback -m 5
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI agent" --type all -m 3
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI agent" --type all+ -m 3 # 含 images
# ⚠️ --type books 结果多来自影子图书馆(Library Genesis 等),谨慎用于版权内容
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "machine learning" --type books
# 全文提取(--extract-length 控制输出长度,默认2000字符)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "topic" --extract
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --extract-url "https://example.com/article"
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --extract-url "https://example.com/article" --extract-length 5000
# 自动降级 + 语言检测(中文→bing优先,英文→brave优先)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --fallback -m 5
# 超时保护(防止搜索挂死)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --timeout 15 --fallback
# 静默模式(隐藏 stderr 重试/超时消息)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --quiet --fallback
# 只输出 URL(一行一条,方便管道处理)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --urls-only --fallback
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --urls-only --type all --fallback
# 时间过滤(d=天, w=周, m=月, y=年)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "最新新闻" -t d --fallback
# 批量搜索(自动语言检测+后端轮换)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --batch-file queries.txt -m 3 -o json
from ddgs import DDGS
with DDGS() as d:
# 搜索
results = list(d.text("query", max_results=5, backend="brave"))
for r in results:
print(r["title"], r["href"], r["body"])
# 搜索后提取全文
content = d.extract(results[0]["href"], fmt="text_markdown")
print(content["content"])
# 其他类型
news = list(d.news("AI agent", max_results=3))
images = list(d.images("AI agents", max_results=3))
videos = list(d.videos("AI agents", max_results=3))
books = list(d.books("machine learning", max_results=3))
// 中文搜索 → Bing CN(500ms,非结构化)
// 必须用 extractMode: "text",markdown 模式会过滤掉搜索结果
web_fetch({"url": "https://cn.bing.com/search?q=Python+教程", "extractMode": "text"})
// 站内搜索
web_fetch({"url": "https://cn.bing.com/search?q=site:github.com+react", "extractMode": "text"})
// 精确匹配
web_fetch({"url": "https://cn.bing.com/search?q=\"exact+phrase\"", "extractMode": "text"})
// 时间过滤(after: 已验证有效)
web_fetch({"url": "https://cn.bing.com/search?q=\"RAG\"+after:2025-06-01", "extractMode": "text"})
详细语法实测结果和 Bing CN 关键词碰撞问题,见 references/advanced-syntax.md
--fallback 自动语言检测: 中文查询 → bing 优先链,英文查询 → brave 优先链。
中文降级链: bing → yandex → yahoo → brave 英文降级链: brave → yandex → yahoo → bing
DDGS 全部失败时: DDGS → web_fetch Bing CN → web_fetch 360 → web_fetch Sogou
判断失败条件:DDGS 抛异常、返回空、超时(>15s 或 --timeout 值)
重要搜索用 2-3 个引擎验证:
const r1 = web_fetch({"url": "https://cn.bing.com/search?q=keyword", "extractMode": "text"})
const r2 = web_fetch({"url": "https://www.so.com/s?q=keyword", "extractMode": "text"})
// 取交集作为高可信结果
| 场景 | 推荐组合 |
|---|---|
| 通用英文搜索 | DDGS brave 单后端 |
| 通用中文搜索 | DDGS bing 单后端 |
| 需要验证的搜索 | DDGS brave + bing |
| 微信/公众号内容 | web_fetch Sogou + WeChat |
| 紧急快速搜索 | web_fetch Bing CN(500ms) |
| 新闻搜索 | DDGS news() |
SearXNG JSON API format请问SearXNG的JSON API格式是什么样的site:edu.cn 量子计算| 问题 | 解决 |
|---|---|
| 结果为空 | web_fetch 改用 extractMode: "text" |
| 国际引擎失败 | 换国内引擎,或用 DDGS |
| 结果不相关 | 加引号精确匹配或用 site: |
| 时间过滤 | 用 after: 操作符(已验证有效) |
| brave 连续搜索空 | 切换到 yandex/yahoo,或等几分钟 |
| 引擎 | 响应时间 | web_fetch | 英文质量 | 中文质量 |
|---|---|---|---|---|
| DDGS brave | ~1.1-1.7s | N/A(库) | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
| DDGS bing | ~1.5s | N/A(库) | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| DDGS yandex | ~1.4s | N/A(库) | ⭐⭐(EN 不稳定) | ⭐⭐⭐ |
| DDGS extract() | ~0.5s | N/A(库) | — | — |
| Bing CN | ~500ms | ✅ | ⭐⭐ | ⭐⭐⭐⭐ |
| 360 | ~1200ms | ✅ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ |