返回顶部
w

web-search网络搜索

Web search using DuckDuckGo Instant Answer API (no API key required). Use when you need to search the web for information, definitions, calculations, conversions, or quick facts. Also use when user mentions "search", "look up", "find information", "what is", "how to", or "google something". The skill provides instant answers, definitions, abstracts, and related topics without requiring external API credentials.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
2,136
下载量
免费
免费
5
收藏
概述
安装方式
版本历史

web-search

网络搜索

使用DuckDuckGo的即时答案API进行免费网络搜索。无需API密钥。

快速开始

bash

基础搜索


cd /home/hxx/clawd/tools && ./web-search.sh 你的查询

示例

./web-search.sh 什么是人工智能 ./web-search.sh Python编程 ./web-search.sh 定义递归 ./web-search.sh 2+2

命令行选项

核心选项

  • - -h, --help - 显示包含使用示例的帮助信息
  • --format <格式> - 输出格式:text、markdown、plain(默认:text)
- text:彩色终端输出(默认) - markdown:干净的Markdown格式(无ANSI颜色) - plain:无颜色的纯文本
  • - --no-color - 禁用彩色输出(等同于--format plain)
  • --max-related - 控制显示的相关主题数量(默认:5)
  • --quiet - 最小输出模式(仅结果,无页眉/页脚)

输出到文件

使用Shell重定向将结果保存到文件:

bash

保存到文件


./web-search.sh 查询 > output.txt

使用Markdown格式

./web-search.sh --format markdown 查询 > results.md

无颜色输出用于日志

./web-search.sh --no-color 查询 > search.log

返回内容

该工具提供多种结果类型:

  • - 答案 - 计算、转换、天气等的直接答案
  • 摘要 - 维基百科风格的摘要,包含来源和URL
  • 定义 - 单词/术语定义
  • 相关主题 - 额外的相关结果(可配置,默认5个)

最佳实践

  1. 1. 具体明确 - 更具体的查询能获得更好的即时答案
  2. 尝试变体 - 若无结果,重新表述查询
  3. 用于事实查询 - 定义、计算、快速查找效果最佳
  4. 检查URL - 始终提供DuckDuckGo链接用于完整搜索
  5. 使用合适的格式
- 终端输出:--format text(彩色,默认) - 文档:--format markdown > file.md - 日志/管道:--format plain 或 --no-color

局限性

  • - 无完整网页搜索结果(仅即时答案)
  • 某些查询返回的结果有限,取决于DuckDuckGo的数据
  • 部分摘要存在字符编码问题(已知限制)
  • 需要网络访问才能查询DuckDuckGo API
  • 并非所有查询类型都返回即时答案(例如,sqrt(144)等复杂数学运算)
  • 并非所有术语都能提供定义
  • 近期新闻可能不会出现(DuckDuckGo专注于常青内容)

使用示例

基础搜索

bash

简单查询

./web-search.sh 开源AI模型

维基百科风格查询

./web-search.sh 什么是递归

Markdown格式

bash

干净的Markdown输出

./web-search.sh --format markdown Python编程

保存到Markdown文件

./web-search.sh --format markdown AI研究 > research.md

纯文本/无颜色

bash

用于日志或管道

./web-search.sh --format plain 搜索查询

显式禁用颜色

./web-search.sh --no-color 搜索查询

控制相关主题

bash

显示更少相关主题

./web-search.sh --max-related 3 机器学习

显示更多相关主题

./web-search.sh --max-related 10 开源

安静模式

bash

最小输出(仅结果)

./web-search.sh --quiet 42 + 7等于多少

组合选项

bash

Markdown格式,无颜色,保存到文件

./web-search.sh --format markdown --no-color 主题 > results.md

安静模式加自定义相关数量

./web-search.sh --quiet --max-related 2 定义

测试场景

已验证可正常工作的场景:

  • - ✅ 计算:2+2、500的10%
  • ✅ 转换:100英里转公里
  • ✅ 维基百科查询:什么是人工智能
  • ✅ 编程:什么是Python、如何安装Docker
  • ✅ 人物:埃隆·马斯克是谁
  • ✅ 科学事实:光速
  • ✅ 天气:东京天气
  • ✅ 边界情况:空查询、特殊字符、无结果
  • ✅ 输出格式:text、markdown、plain
  • ✅ 标志:--help、--format、--no-color、--max-related、--quiet

详细测试结果请参见test-outputs.md

故障排除

未找到直接结果

尝试重新表述查询,或使用提供的DuckDuckGo URL进行完整搜索。

网络错误

检查网络连接。该工具需要网络访问。

字符编码问题

部分摘要显示乱码。这是基础解析的已知问题(安装jq可获得更好结果)。

未找到jq警告

该工具使用基础文本提取无需jq即可运行,但安装jq可改进JSON解析: bash

Ubuntu/Debian

sudo apt-get install jq

macOS

brew install jq

通过包管理器

npm install -g jq

输出格式

文本格式(默认)

  • - 蓝色 - 页眉和搜索信息
  • 绿色 - 结果标记和内容
  • 黄色 - 来源、URL和警告
  • 红色 - 错误

使用--format plain或--no-color禁用颜色。

Markdown格式

干净的Markdown,包含:
  • - ## 章节标题
  • 粗体 用于强调
  • - 项目符号列表
  • 斜体 用于元数据
  • [链接]() 用于URL

纯文本格式

无ANSI代码或Markdown格式 - 适用于日志和管道。

要求

  • - curl 或 wget(用于HTTP请求)
  • 可选:jq(用于更好的JSON解析)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 web-search-instant-1776369468 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 web-search-instant-1776369468 技能

通过命令行安装

skillhub install web-search-instant-1776369468

下载

⬇ 下载 web-search v1.1.0(免费)

文件大小: 16.68 KB | 发布时间: 2026-4-17 16:17

v1.1.0 最新 2026-4-17 16:17
# Web Search Instant - v1.1.0

## New Features

- Added `--format` option for output formats (text, markdown, plain)
- Added `--no-color` option to disable colored output
- Added `--max-related` option to control number of related topics
- Added `--quiet` option for minimal output (no headers/footer)
- Improved `--help` with comprehensive usage documentation
- Updated SKILL.md with new options and usage examples
- Created new test suite (test-new-features.sh) for validation

## Changes

- Markdown output uses `##` headers, `**bold**`, `-` bullets, and `[links]()`
- Plain/text formats preserve colored ANSI output by default
- All options work independently and in combination
- Output to file supported via shell redirection

## Testing

All 12 feature tests passing:
- ✅ --help flag
- ✅ --format markdown
- ✅ --format plain
- ✅ --no-color
- ✅ --max-related 2
- ✅ --max-related 10
- ✅ --quiet
- ✅ Combined options (--format markdown --no-color)
- ✅ Combined options (--quiet --max-related 3)
- ✅ Output to file
- ✅ Invalid format validation
- ✅ Default format (text with colors)

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部