Ddg Search Fetch

基于 DuckDuckGo 实现无密钥网页搜索与内容提取,支持自动触发。

已扫描
适合谁
需要快速获取公开网络信息的开发者、希望实现无密钥网页数据采集的自动化用户
不适合谁
需要访问受密码保护或需登录的网页内容的用户、对隐私安全要求极高、禁止外部网络请求的环境使用者
国内可用性
需网络配置。可能需要网络配置或第三方服务可访问。
安装难度
新手友好(★☆☆)。基于终端操作、依赖、API Key 和本地环境要求的初步判断。

安装与下载

openclaw skills install @mengbin92/ddg-search-fetch

Skill 说明

命令、参数、文件名以原文为准

DuckDuckGo 搜索与抓取

使用 DuckDuckGo 进行网络搜索并获取网页内容(无需 API 密钥)。

前置条件

需要安装依赖:

pip3 install duckduckgo-search

功能

1. 网页搜索 (ddg_search.py)

python3 scripts/ddg_search.py "您的搜索关键词" [--max-results 10]

2. 网页抓取 (ddg_fetch.py)

python3 scripts/ddg_fetch.py "https://example.com" [--timeout 30]

使用示例

搜索

# 基础搜索
python3 scripts/ddg_search.py "OpenClaw AI agent"

# 获取更多结果
python3 scripts/ddg_search.py "Python 最佳实践" --max-results 15

抓取网页

# 抓取网页内容
python3 scripts/ddg_fetch.py "https://openclaw.ai"

# 自定义超时时间
python3 scripts/ddg_fetch.py "https://example.com" --timeout 15

# 输出纯文本
python3 scripts/ddg_fetch.py "https://example.com" --format text

输出格式

搜索结果 (JSON)

{
  "query": "搜索关键词",
  "count": 10,
  "results": [
    {
      "title": "结果标题",
      "url": "https://example.com",
      "snippet": "描述摘要"
    }
  ]
}

抓取结果 (JSON)

{
  "url": "https://example.com",
  "title": "页面标题",
  "text": "提取的可读内容...",
  "description": "元描述",
  "status_code": 200,
  "error": null
}

与 OpenClaw 集成

示例工作流

# 搜索
result = exec({
    "command": "python3 /path/to/skills/duckduckgo-search/scripts/ddg_search.py query"
})
# 解析:json.loads(result.stdout)

# 抓取 URL
result = exec({
    "command": "python3 /path/to/skills/duckduckgo-search/scripts/ddg_fetch.py https://example.com"
})
# 解析:json.loads(result.stdout)
M
@mengbin92

已收录 1 个 Skill

相关推荐