$npx -y skills add AlexAI-MCP/hermes-CCC --skill duckduckgo-searchFree web search via DuckDuckGo - no API key needed. Text, news, images. Use as fallback when other search tools unavailable.
| 1 | # DuckDuckGo Search |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Use this skill for lightweight web search without an API key. |
| 6 | - It is useful as a fallback when paid search APIs or first-party tools are unavailable. |
| 7 | - The library supports text, news, and image search. |
| 8 | - This is a pragmatic option for prototyping, research helpers, and lightweight retrieval. |
| 9 | |
| 10 | ## Install |
| 11 | |
| 12 | ```bash |
| 13 | pip install duckduckgo-search |
| 14 | ``` |
| 15 | |
| 16 | ## Why Use It |
| 17 | |
| 18 | - No API key required. |
| 19 | - Easy Python integration. |
| 20 | - Useful CLI for quick terminal searches. |
| 21 | - Supports regions and time filters for fresher results. |
| 22 | - Good fallback for general web discovery. |
| 23 | |
| 24 | ## Python API |
| 25 | |
| 26 | - The main entry point is the `DDGS` class. |
| 27 | - Create a client and call the relevant search method. |
| 28 | - Iterate the generator or cast results to a list. |
| 29 | |
| 30 | ## Text Search Example |
| 31 | |
| 32 | ```python |
| 33 | from duckduckgo_search import DDGS |
| 34 | |
| 35 | with DDGS() as ddgs: |
| 36 | results = ddgs.text("vector databases for rag", max_results=10) |
| 37 | for item in results: |
| 38 | print(item["title"]) |
| 39 | print(item["href"]) |
| 40 | print(item["body"]) |
| 41 | print() |
| 42 | ``` |
| 43 | |
| 44 | - `text()` is the default choice for general web results. |
| 45 | - Use concise queries first, then refine. |
| 46 | - Extract only the fields you actually need for downstream processing. |
| 47 | |
| 48 | ## News Search Example |
| 49 | |
| 50 | ```python |
| 51 | from duckduckgo_search import DDGS |
| 52 | |
| 53 | with DDGS() as ddgs: |
| 54 | results = ddgs.news( |
| 55 | keywords="open source llm releases", |
| 56 | max_results=10, |
| 57 | region="us-en", |
| 58 | timelimit="w", |
| 59 | ) |
| 60 | for item in results: |
| 61 | print(item["title"]) |
| 62 | print(item["date"]) |
| 63 | print(item["url"]) |
| 64 | ``` |
| 65 | |
| 66 | - News search is better than general text search when recency matters. |
| 67 | - Useful parameters include `keywords`, `max_results`, `region`, and `timelimit`. |
| 68 | - Prefer short keyword-focused queries over verbose natural language. |
| 69 | |
| 70 | ## Image Search Example |
| 71 | |
| 72 | ```python |
| 73 | from duckduckgo_search import DDGS |
| 74 | |
| 75 | with DDGS() as ddgs: |
| 76 | results = ddgs.images("server rack diagram", max_results=10) |
| 77 | for item in results: |
| 78 | print(item["title"]) |
| 79 | print(item["image"]) |
| 80 | ``` |
| 81 | |
| 82 | - `ddgs.images(keywords, max_results)` is the simplest path for image discovery. |
| 83 | - Verify licensing and usage rights before reuse. |
| 84 | - Image results are best for inspiration, references, and visual discovery rather than authoritative facts. |
| 85 | |
| 86 | ## CLI Usage |
| 87 | |
| 88 | ```bash |
| 89 | ddgs text -k "query" -m 10 |
| 90 | ``` |
| 91 | |
| 92 | - `text` runs a standard web search. |
| 93 | - `-k` sets the keywords. |
| 94 | - `-m 10` limits the maximum number of results. |
| 95 | - This is useful for shell scripts or quick ad hoc research. |
| 96 | |
| 97 | ## CLI Patterns |
| 98 | |
| 99 | ```bash |
| 100 | ddgs text -k "python async queue patterns" -m 10 |
| 101 | ddgs news -k "gpu inference news" -m 5 |
| 102 | ddgs images -k "er diagram examples" -m 8 |
| 103 | ``` |
| 104 | |
| 105 | - Use CLI mode when you want zero boilerplate. |
| 106 | - Use Python mode when you need structured post-processing. |
| 107 | |
| 108 | ## Regions |
| 109 | |
| 110 | - `wt-wt` for global results |
| 111 | - `us-en` for United States English |
| 112 | - `kr-ko` for Korea Korean |
| 113 | - regional values can materially change ranking and language mix |
| 114 | |
| 115 | Region examples: |
| 116 | |
| 117 | ```python |
| 118 | results = ddgs.text("open banking regulation", region="wt-wt", max_results=10) |
| 119 | results = ddgs.text("AI policy", region="us-en", max_results=10) |
| 120 | results = ddgs.news("반도체 투자", region="kr-ko", max_results=10) |
| 121 | ``` |
| 122 | |
| 123 | ## Time Limits |
| 124 | |
| 125 | - `d` for day |
| 126 | - `w` for week |
| 127 | - `m` for month |
| 128 | - `y` for year |
| 129 | |
| 130 | Use time limits when: |
| 131 | |
| 132 | - tracking current events |
| 133 | - watching new releases |
| 134 | - checking recent blog or news coverage |
| 135 | - reducing stale results |
| 136 | |
| 137 | ## Rate Limiting |
| 138 | |
| 139 | - Do not hammer the service with rapid repeated requests. |
| 140 | - Add a short sleep between loops or batches. |
| 141 | - Cache results locally when queries repeat. |
| 142 | - If you are scraping many queries, batch slowly and keep scope tight. |
| 143 | |
| 144 | Simple pattern: |
| 145 | |
| 146 | ```python |
| 147 | import time |
| 148 | from duckduckgo_search import DDGS |
| 149 | |
| 150 | queries = ["llm evals", "vector db benchmarks", "open source agents"] |
| 151 | |
| 152 | with DDGS() as ddgs: |
| 153 | for q in queries: |
| 154 | results = list(ddgs.text(q, max_results=5)) |
| 155 | print(q, len(results)) |
| 156 | time.sleep(2) |
| 157 | ``` |
| 158 | |
| 159 | ## Query Strategy |
| 160 | |
| 161 | - Start broad, then narrow. |
| 162 | - Prefer keywords over long questions. |
| 163 | - Use quotes only when exact phrase matching matters. |
| 164 | - Switch to news mode when freshness matters more than general authority. |
| 165 | - Use the region parameter intentionally rather than leaving locality to chance. |
| 166 | |
| 167 | ## Fallback Positioning |
| 168 | |
| 169 | - No API key required means this is a practical fallback. |
| 170 | - It is well suited to a `WebSearch` fallback path in tools or scripts. |
| 171 | - When other providers fail, DDG search can still return useful retrieval candidates. |
| 172 | - It should not be treated as a guaranteed enterprise-grade SLA service. |
| 173 | |
| 174 | ## Practical Research Workflow |
| 175 | |
| 176 | 1. Run a text search for broad discovery. |
| 177 | 2. Switch |