DuckDuckGo(API)
/install ddgs-search-api
DuckDuckGo Web Search Skill
An Agent Skill for searching web content via DuckDuckGo.
Overview
This Skill provides a command-line tool for web search using the ddgs Python package. Suitable for:
- Real-time web information needs in AI coding tools
- Fetching search results in OpenClaw workflows
Core Features
- Web Search: General web search
- News Search: Dedicated news content search
- Multiple Output Formats: Text or JSON format
- Flexible Configuration: Region, time limits, and safe search level
- Proxy Support: HTTP/HTTPS/SOCKS5 proxy via CLI args or environment variables
Installation
This project uses uv as the Python package manager.
Option 1: Run with uv (Recommended)
# Run the script directly (uv will auto-install dependencies)
uv run scripts/ddgs_search.py "Python programming"
# Or navigate to the directory first
cd skills/ddgs-search
uv run scripts/ddgs_search.py "machine learning"
Option 2: Manual Dependency Installation
# Install dependencies using uv
uv pip install ddgs
# Or use pip
pip install ddgs
Quick Start
Basic Usage
# Run with uv (recommended)
uv run scripts/ddgs_search.py "Python programming"
# Limit the number of results
uv run scripts/ddgs_search.py "machine learning" --max-results 5
# Search news
uv run scripts/ddgs_search.py "tech news" --news
# JSON output (for programmatic parsing)
uv run scripts/ddgs_search.py "API documentation" --json
# Time limit (today)
uv run scripts/ddgs_search.py "breaking news" --timelimit d
Complete Parameter Reference
| Parameter | Short | Description | Default |
|---|---|---|---|
query |
- | Search keywords | Required |
--max-results |
-n |
Maximum number of results | 10 |
--region |
-r |
Region code | wt-wt |
--safesearch |
-s |
Safe search (on/moderate/off) | moderate |
--timelimit |
-t |
Time limit (d/w/m/y) | - |
--backend |
-b |
Search backend (auto/html/lite) | auto |
--proxy |
-p |
Proxy server (http/https/socks5) | - |
--news |
- | Search news | - |
--json |
-j |
JSON format output | - |
--verbose |
-v |
Show detailed information | - |
Proxy Configuration
Proxy settings are resolved in the following priority order:
- Command line:
--proxy/-p - Environment variable:
HTTP_PROXYorhttp_proxy - Environment variable:
DDGS_PROXY
Proxy format examples:
http://proxy.example.com:8080http://user:[email protected]:8080socks5://127.0.0.1:9150(Tor Browser)socks5h://user:[email protected]:32325
Region Code Examples
wt-wt- Worldwide (default)us-en- United States Englishcn-zh- China Chinesejp-jp- Japanuk-en- United Kingdom
Time Limits
d- Past dayw- Past weekm- Past monthy- Past year
Usage in OpenClaw
In OpenClaw workflows, you can invoke it via the bash tool:
# Example workflow step
- name: search_web
tool: bash
command: cd skills/ddgs-search && uv run scripts/ddgs_search.py "{{ query }}" --json
Or using the Python tool:
# Assuming the current directory is the project root
import subprocess
import json
result = subprocess.run(
["uv", "run", "skills/ddgs-search/scripts/ddgs_search.py", "Python tips", "--json"],
capture_output=True,
text=True
)
data = json.loads(result.stdout)
Return Result Format
Web Search Results
[
{
"title": "Result Title",
"href": "https://example.com/page",
"body": "Page snippet/description..."
}
]
News Search Results
[
{
"title": "News Headline",
"href": "https://news.example.com/article",
"body": "Article summary...",
"date": "2024-01-15",
"source": "News Source Name"
}
]
Usage Examples
Example 1: Search Technical Documentation
uv run scripts/ddgs_search.py "FastAPI documentation" -n 5
Example 2: Get Latest News
uv run scripts/ddgs_search.py "artificial intelligence" --news -t d -n 3
Example 3: Chinese Search
uv run scripts/ddgs_search.py "机器学习教程" -r cn-zh -n 8
Example 4: JSON Output Processing
uv run scripts/ddgs_search.py "python tips" --json | jq '.[0].href'
Example 5: Using Proxy
# Via command line argument
uv run scripts/ddgs_search.py "query" --proxy http://1.2.3.4:8080
# Via HTTP_PROXY environment variable
export HTTP_PROXY="http://proxy.example.com:8080"
uv run scripts/ddgs_search.py "query"
# Via DDGS_PROXY environment variable
export DDGS_PROXY="socks5://127.0.0.1:9150"
uv run scripts/ddgs_search.py "query"
FAQ
uv Not Installed
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
ImportError: No module named 'ddgs'
# Install using uv
uv pip install ddgs
# Or run in the script directory (uv will auto-handle)
cd skills/ddgs-search
uv run scripts/ddgs_search.py "query"
Empty Search Results
- Check network connection
- Try changing the
--backendparameter (auto/html/lite) - Some regions may require a proxy (see Proxy Configuration)
Proxy Not Working
- Verify proxy format:
http://host:portorsocks5://host:port - Check if authentication is required:
http://user:pass@host:port - Ensure the proxy server is accessible from your network
- Try using
HTTP_PROXYenvironment variable instead of command line argument
Rate Limiting
DuckDuckGo has implicit rate limiting. If frequent requests fail:
- Reduce request frequency
- Add delays between requests
- Use a different backend
Dependencies
- Python 3.9+
uv(package manager)ddgs>= 8.0.0
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ddgs-search-api - 安装完成后,直接呼叫该 Skill 的名称或使用
/ddgs-search-api触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
DuckDuckGo(API) 是什么?
Use when needing to search the web in AI coding tools or OpenClaw. Uses DuckDuckGo API without API key. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 338 次。
如何安装 DuckDuckGo(API)?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install ddgs-search-api」即可一键安装,无需额外配置。
DuckDuckGo(API) 是免费的吗?
是的,DuckDuckGo(API) 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
DuckDuckGo(API) 支持哪些平台?
DuckDuckGo(API) 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 DuckDuckGo(API)?
由 bird-frank(@bird-frank)开发并维护,当前版本 v0.2.0。