hermes-agent/skills/research/duckduckgo-search/scripts/duckduckgo.sh
teknium1 2af2f148ab refactor: rewrite duckduckgo-search skill for accuracy and usability
Follow-up to PR #267 merge:
- Fix CLI syntax: -k is keywords, -m is max results (was reversed)
- Add clear trigger condition: use only when web_search tool unavailable
- Remove misleading curl fallback (DuckDuckGo Instant Answer API is not
  a web search endpoint)
- Fix package name: ddgs (renamed from duckduckgo-search)
- Add workflow section for search → web_extract pipeline
- Add pitfalls and limitations sections
- Fix author attribution to actual contributor
- Rewrite shell script as simple ddgs wrapper with availability check
2026-03-04 22:11:09 -08:00

28 lines
621 B
Bash
Executable file

#!/bin/bash
# DuckDuckGo Search Helper Script
# Wrapper around ddgs CLI with sensible defaults
# Usage: ./duckduckgo.sh <query> [max_results]
set -e
QUERY="$1"
MAX_RESULTS="${2:-5}"
if [ -z "$QUERY" ]; then
echo "Usage: $0 <query> [max_results]"
echo ""
echo "Examples:"
echo " $0 'python async programming' 5"
echo " $0 'latest AI news' 10"
echo ""
echo "Requires: pip install ddgs"
exit 1
fi
# Check if ddgs is available
if ! command -v ddgs &> /dev/null; then
echo "Error: ddgs not found. Install with: pip install ddgs"
exit 1
fi
ddgs text -k "$QUERY" -m "$MAX_RESULTS"