ducksearch - 由微信公众号字节笔记本提供
npm install ducksearch由微信公众号「字节笔记本」提供
网页搜索和内容提取命令行工具
- 🔍 网络搜索: 使用 DuckDuckGo 搜索引擎
- 📥 内容提取: 获取网页纯文本内容
- 🚀 MCP 服务器: 支持 Claude Code/MCP 集成
- ⚡ 快速高效: 内存管理和批处理优化
``bash搜索
npx ducksearch search "关键词"
$3
`bash
npm install -g ducksearch然后直接使用
ducksearch search "关键词"
ducksearch fetch https://example.com
`命令详解
$3
`bash
基本搜索
npx ducksearch search "关键词"指定结果数量
npx ducksearch search "关键词" -n 20搜索并自动打开第一个结果
npx ducksearch search "关键词" -o
`$3
`bash
获取网页内容(预览)
npx ducksearch fetch https://example.com获取原始 HTML
npx ducksearch fetch https://example.com --raw保存到文件
npx ducksearch fetch https://example.com -o output.txt输出 JSON 格式
npx ducksearch fetch https://example.com --json
`MCP 服务器配置
在 Claude Code 中使用,添加到 MCP 配置:
`json
{
"mcpServers": {
"ducksearch": {
"command": "npx",
"args": ["-y", "ducksearch", "mcp"]
}
}
}
``1. DuckDuckGoWebSearch
- 输入: 搜索关键词和最大结果数
- 输出: 格式化的搜索结果列表
2. UrlContentExtractor
- 输入: 单个 URL 或 URL 数组
- 输出: 网页纯文本内容
- TypeScript
- Node.js
- Axios (HTTP 请求)
- Cheerio (HTML 解析)
- Commander.js (CLI 框架)
- MCP SDK
MIT
微信公众号:字节笔记本