Install
openclaw skills install ddgs-search-apiUse when needing to search the web in AI coding tools or OpenClaw. Uses DuckDuckGo API without API key.
openclaw skills install ddgs-search-apiAn Agent Skill for searching web content via DuckDuckGo.
This Skill provides a command-line tool for web search using the ddgs Python package. Suitable for:
This project uses uv as the Python package manager.
# 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"
# Install dependencies using uv
uv pip install ddgs
# Or use pip
pip install ddgs
# 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
| 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 settings are resolved in the following priority order:
--proxy / -pHTTP_PROXY or http_proxyDDGS_PROXYProxy format examples:
http://proxy.example.com:8080http://user:pass@proxy.example.com:8080socks5://127.0.0.1:9150 (Tor Browser)socks5h://user:password@geo.iproyal.com:32325wt-wt - Worldwide (default)us-en - United States Englishcn-zh - China Chinesejp-jp - Japanuk-en - United Kingdomd - Past dayw - Past weekm - Past monthy - Past yearIn 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)
[
{
"title": "Result Title",
"href": "https://example.com/page",
"body": "Page snippet/description..."
}
]
[
{
"title": "News Headline",
"href": "https://news.example.com/article",
"body": "Article summary...",
"date": "2024-01-15",
"source": "News Source Name"
}
]
uv run scripts/ddgs_search.py "FastAPI documentation" -n 5
uv run scripts/ddgs_search.py "artificial intelligence" --news -t d -n 3
uv run scripts/ddgs_search.py "机器学习教程" -r cn-zh -n 8
uv run scripts/ddgs_search.py "python tips" --json | jq '.[0].href'
# 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"
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# 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"
--backend parameter (auto/html/lite)http://host:port or socks5://host:porthttp://user:pass@host:portHTTP_PROXY environment variable instead of command line argumentDuckDuckGo has implicit rate limiting. If frequent requests fail:
uv (package manager)ddgs >= 8.0.0