{"id":29325747,"url":"https://github.com/deedy5/ddgs","last_synced_at":"2026-04-02T15:28:56.561Z","repository":{"id":42059119,"uuid":"361511031","full_name":"deedy5/ddgs","owner":"deedy5","description":"DDGS | Dux Distributed Global Search. A metasearch library that aggregates results from diverse web search services","archived":false,"fork":false,"pushed_at":"2026-02-14T07:35:48.000Z","size":781,"stargazers_count":2177,"open_issues_count":14,"forks_count":220,"subscribers_count":19,"default_branch":"main","last_synced_at":"2026-02-14T15:44:50.120Z","etag":null,"topics":["api","ddgs","mcp","mcp-server","metasearch","python","search","websearch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deedy5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-25T18:46:43.000Z","updated_at":"2026-02-14T08:26:36.000Z","dependencies_parsed_at":"2023-01-31T07:30:50.267Z","dependency_job_id":"eed65326-1464-4b3d-b067-8e4c306204a4","html_url":"https://github.com/deedy5/ddgs","commit_stats":{"total_commits":178,"total_committers":2,"mean_commits":89.0,"dds":0.005617977528089901,"last_synced_commit":"376a80c90aaa3a8c5360c4ad27e027cd55d12aad"},"previous_names":["deedy5/ddgs","deedy5/duckduckgo_search"],"tags_count":204,"template":false,"template_full_name":null,"purl":"pkg:github/deedy5/ddgs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deedy5%2Fddgs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deedy5%2Fddgs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deedy5%2Fddgs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deedy5%2Fddgs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deedy5","download_url":"https://codeload.github.com/deedy5/ddgs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deedy5%2Fddgs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29957128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","ddgs","mcp","mcp-server","metasearch","python","search","websearch"],"created_at":"2025-07-07T18:02:05.978Z","updated_at":"2026-04-02T15:28:56.545Z","avatar_url":"https://github.com/deedy5.png","language":"Python","funding_links":[],"categories":["Python","📚 Projects (2474 total)","MCP Frameworks and libraries"],"sub_categories":["MCP Servers","Python"],"readme":"![Python \u003e= 3.10](https://img.shields.io/badge/python-\u003e=3.10-red.svg) [![](https://badgen.net/github/release/deedy5/ddgs)](https://github.com/deedy5/ddgs/releases) [![](https://badge.fury.io/py/ddgs.svg)](https://pypi.org/project/ddgs)\n# DDGS | Dux Distributed Global Search\u003ca name=\"TOP\"\u003e\u003c/a\u003e\n\nA metasearch library that aggregates results from diverse web search services.\n\n\n## Table of Contents\n* [Install](#install)\n* [CLI version](#cli-version)\n* [API Server (with MCP Integration)](#api-server-with-mcp-integration)\n* [Engines](#engines)\n* [DDGS class](#ddgs-class)\n* [1. text()](#1-text)\n* [2. images()](#2-images)\n* [3. videos()](#3-videos)\n* [4. news()](#4-news)\n* [5. books()](#5-books)\n* [6. extract()](#6-extract)\n* [Disclaimer](#disclaimer)\n\n___\n## Install\n```python\npip install -U ddgs       # Base install\npip install -U ddgs[mcp]  # With MCP server (stdio)\npip install -U ddgs[api]  # With MCP + API server (SSE + FastAPI)\n```\n\n## CLI version\n\n```python3\nddgs --help\n```\n\n[Go To TOP](#TOP)\n___\n\n## API Server (with MCP Integration)\n\n- **Install**\n```bash\npip install -U ddgs[mcp]  # MCP server (stdio)\npip install -U ddgs[api]  # MCP + API server (SSE + FastAPI)\n```\n\n- **CLI**\n```bash\nddgs mcp    # Start MCP server (stdio transport, for local MCP clients)\nddgs mcp -pr socks5h://127.0.0.1:9150  # with proxy\nddgs api    # Start MCP + API server (SSE transport + FastAPI)\nddgs api -d # Start in detached mode\nddgs api -s # Stop detached server\nddgs api --host 127.0.0.1 --port 9000 -pr socks5h://127.0.0.1:9150  # Custom host / port / proxy\n```\n\n- **Docker compose**\n```bash\ngit clone https://github.com/deedy5/ddgs \u0026\u0026 cd ddgs\ndocker-compose up --build\n```\n\n- **Bash script**\n```bash\ngit clone https://github.com/deedy5/ddgs \u0026\u0026 cd ddgs\nchmod +x start_api.sh\n./start_api.sh\n```\n\n#### Available Endpoints\n- MCP Endpoints (for AI assistants):\n    - **stdio** — `ddgs mcp`\n    - **sse** — `ddgs api`(`http://localhost:8000/sse`)\n- API Docs: `http://localhost:8000/docs`\n- Health Check: `http://localhost:8000/health`\n\n#### Available MCP Tools\n- `search_text` - Web text searches\n- `search_images` - Image searches\n- `search_news` - News searches\n- `search_videos` - Video searches\n- `search_books` - Book searches\n- `extract_content` - Extract content from a URL\n\n#### Typical configuration\n\n- **stdio** (for local MCP clients):\n```json\n{\n  \"mcpServers\": {\n    \"ddgs\": {\n      \"command\": \"ddgs\",\n      \"args\": [\"mcp\"]\n    }\n  }\n}\n```\n\n- **SSE** (for HTTP-based MCP clients):\n```json\n{\n  \"mcpServers\": {\n    \"ddgs\": {\n      \"url\": \"http://localhost:8000/sse\"\n    }\n  }\n}\n```\n\n[Go To TOP](#TOP)\n___\n\n## Engines\n\n| DDGS function | Available backends |\n| --------------|:-------------------|\n| text()        | `bing`, `brave`, `duckduckgo`, `google`, `grokipedia`, `mojeek`, `yandex`, `yahoo`, `wikipedia`|\n| images()      | `duckduckgo` |\n| videos()      | `duckduckgo` |\n| news()        | `bing`, `duckduckgo`, `yahoo` |\n| books()       | `annasarchive` |\n\n[Go To TOP](#TOP)\n\n## DDGS class\n\nDDGS class is lazy-loaded.\n\n```python3\nclass DDGS:\n    \"\"\"Dux Distributed Global Search. A metasearch library that aggregates results from diverse web search services.\n\n    Args:\n        proxy (str, optional): proxy for the HTTP client, supports http/https/socks5 protocols.\n            example: \"http://user:pass@example.com:3128\". Defaults to None.\n        timeout (int, optional): Timeout value for the HTTP client. Defaults to 5.\n        verify: (bool | str):  True to verify, False to skip, or a str path to a PEM file. Defaults to True.\n    \"\"\"\n```\n\nHere is an example of initializing the DDGS class.\n```python3\nfrom ddgs import DDGS\n\nresults = DDGS().text(\"python programming\", max_results=5)\nprint(results)\n```\n\n[Go To TOP](#TOP)\n\n## 1. text()\n\n```python\ndef text(\n    query: str,\n    region: str = \"us-en\",\n    safesearch: str = \"moderate\",\n    timelimit: str | None = None,\n    max_results: int | None = 10,\n    page: int = 1,\n    backend: str = \"auto\",\n) -\u003e list[dict[str, str]]:\n    \"\"\"DDGS text metasearch.\n\n    Args:\n        query: text search query.\n        region: us-en, uk-en, ru-ru, etc. Defaults to us-en.\n        safesearch: on, moderate, off. Defaults to \"moderate\".\n        timelimit: d, w, m, y. Defaults to None.\n        max_results: maximum number of results. Defaults to 10.\n        page: page of results. Defaults to 1.\n        backend: A single or comma-delimited backends. Defaults to \"auto\".\n\n    Returns:\n        List of dictionaries with search results.\n    \"\"\"\n```\n***Example***\n```python\nresults = DDGS().text('live free or die', region='us-en', safesearch='off', timelimit='y', page=1, backend=\"auto\")\n# Searching for pdf files\nresults = DDGS().text('russia filetype:pdf', region='us-en', safesearch='off', timelimit='y', page=1, backend=\"auto\")\nprint(results)\n[\n    {\n        \"title\": \"News, sport, celebrities and gossip | The Sun\",\n        \"href\": \"https://www.thesun.co.uk/\",\n        \"body\": \"Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The Sun\",\n    }, ...\n]\n```\n\n[Go To TOP](#TOP)\n\n## 2. images()\n\n```python\ndef images(\n    query: str,\n    region: str = \"us-en\",\n    safesearch: str = \"moderate\",\n    timelimit: str | None = None,\n    max_results: int | None = 10,\n    page: int = 1,\n    backend: str = \"auto\",\n    size: str | None = None,\n    color: str | None = None,\n    type_image: str | None = None,\n    layout: str | None = None,\n    license_image: str | None = None,\n) -\u003e list[dict[str, str]]:\n    \"\"\"DDGS images metasearch.\n\n    Args:\n        query: images search query.\n        region: us-en, uk-en, ru-ru, etc. Defaults to us-en.\n        safesearch: on, moderate, off. Defaults to \"moderate\".\n        timelimit: d, w, m, y. Defaults to None.\n        max_results: maximum number of results. Defaults to 10.\n        page: page of results. Defaults to 1.\n        backend: A single or comma-delimited backends. Defaults to \"auto\".\n        size: Small, Medium, Large, Wallpaper. Defaults to None.\n        color: color, Monochrome, Red, Orange, Yellow, Green, Blue,\n            Purple, Pink, Brown, Black, Gray, Teal, White. Defaults to None.\n        type_image: photo, clipart, gif, transparent, line.\n            Defaults to None.\n        layout: Square, Tall, Wide. Defaults to None.\n        license_image: any (All Creative Commons), Public (PublicDomain),\n            Share (Free to Share and Use), ShareCommercially (Free to Share and Use Commercially),\n            Modify (Free to Modify, Share, and Use), ModifyCommercially (Free to Modify, Share, and\n            Use Commercially). Defaults to None.\n\n    Returns:\n        List of dictionaries with images search results.\n    \"\"\"\n```\n***Example***\n```python\nresults = DDGS().images(\n    query=\"butterfly\",\n    region=\"us-en\",\n    safesearch=\"off\",\n    timelimit=\"m\",\n    page=1,\n    backend=\"auto\",\n    size=None,\n    color=\"Monochrome\",\n    type_image=None,\n    layout=None,\n    license_image=None,\n)\nprint(images)\n[\n    {\n        \"title\": \"File:The Sun by the Atmospheric Imaging Assembly of NASA's Solar ...\",\n        \"image\": \"https://upload.wikimedia.org/wikipedia/commons/b/b4/The_Sun_by_the_Atmospheric_Imaging_Assembly_of_NASA's_Solar_Dynamics_Observatory_-_20100819.jpg\",\n        \"thumbnail\": \"https://tse4.mm.bing.net/th?id=OIP.lNgpqGl16U0ft3rS8TdFcgEsEe\u0026pid=Api\",\n        \"url\": \"https://en.wikipedia.org/wiki/File:The_Sun_by_the_Atmospheric_Imaging_Assembly_of_NASA's_Solar_Dynamics_Observatory_-_20100819.jpg\",\n        \"height\": 3860,\n        \"width\": 4044,\n        \"source\": \"Bing\",\n    }, ...\n]\n```\n\n[Go To TOP](#TOP)\n\n## 3. videos()\n\n```python\ndef videos(\n    query: str,\n    region: str = \"us-en\",\n    safesearch: str = \"moderate\",\n    timelimit: str | None = None,\n    max_results: int | None = 10,\n    page: int = 1,\n    backend: str = \"auto\",\n    resolution: str | None = None,\n    duration: str | None = None,\n    license_videos: str | None = None,\n) -\u003e list[dict[str, str]]:\n    \"\"\"DDGS videos metasearch.\n\n    Args:\n        query: videos search query.\n        region: us-en, uk-en, ru-ru, etc. Defaults to us-en.\n        safesearch: on, moderate, off. Defaults to \"moderate\".\n        timelimit: d, w, m. Defaults to None.\n        max_results: maximum number of results. Defaults to 10.\n        page: page of results. Defaults to 1.\n        backend: A single or comma-delimited backends. Defaults to \"auto\".\n        resolution: high, standart. Defaults to None.\n        duration: short, medium, long. Defaults to None.\n        license_videos: creativeCommon, youtube. Defaults to None.\n\n    Returns:\n        List of dictionaries with videos search results.\n    \"\"\"\n```\n***Example***\n```python\nresults = DDGS().videos(\n    query=\"cars\",\n    region=\"us-en\",\n    safesearch=\"off\",\n    timelimit=\"w\",\n    page=1,\n    backend=\"auto\",\n    resolution=\"high\",\n    duration=\"medium\",\n)\nprint(results)\n[\n    {\n        \"content\": \"https://www.youtube.com/watch?v=6901-C73P3g\",\n        \"description\": \"Watch the Best Scenes of popular Tamil Serial #Meena that airs on Sun TV. Watch all Sun TV serials immediately after the TV telecast on Sun NXT app. *Free for Indian Users only Download here: Android - http://bit.ly/SunNxtAdroid iOS: India - http://bit.ly/sunNXT Watch on the web - https://www.sunnxt.com/ Two close friends, Chidambaram ...\",\n        \"duration\": \"8:22\",\n        \"embed_html\": '\u003ciframe width=\"1280\" height=\"720\" src=\"https://www.youtube.com/embed/6901-C73P3g?autoplay=1\" frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e',\n        \"embed_url\": \"https://www.youtube.com/embed/6901-C73P3g?autoplay=1\",\n        \"image_token\": \"6c070b5f0e24e5972e360d02ddeb69856202f97718ea6c5d5710e4e472310fa3\",\n        \"images\": {\n            \"large\": \"https://tse4.mm.bing.net/th?id=OVF.JWBFKm1u%2fHd%2bz2e1GitsQw\u0026pid=Api\",\n            \"medium\": \"https://tse4.mm.bing.net/th?id=OVF.JWBFKm1u%2fHd%2bz2e1GitsQw\u0026pid=Api\",\n            \"motion\": \"\",\n            \"small\": \"https://tse4.mm.bing.net/th?id=OVF.JWBFKm1u%2fHd%2bz2e1GitsQw\u0026pid=Api\",\n        },\n        \"provider\": \"Bing\",\n        \"published\": \"2024-07-03T05:30:03.0000000\",\n        \"publisher\": \"YouTube\",\n        \"statistics\": {\"viewCount\": 29059},\n        \"title\": \"Meena - Best Scenes | 02 July 2024 | Tamil Serial | Sun TV\",\n        \"uploader\": \"Sun TV\",\n    }, ...\n]\n```\n\n[Go To TOP](#TOP)\n\n## 4. news()\n\n```python\ndef news(\n    query: str,\n    region: str = \"us-en\",\n    safesearch: str = \"moderate\",\n    timelimit: str | None = None,\n    max_results: int | None = 10,\n    page: int = 1,\n    backend: str = \"auto\",\n) -\u003e list[dict[str, str]]:\n    \"\"\"DDGS news metasearch.\n\n    Args:\n        query: news search query.\n        region: us-en, uk-en, ru-ru, etc. Defaults to us-en.\n        safesearch: on, moderate, off. Defaults to \"moderate\".\n        timelimit: d, w, m. Defaults to None.\n        max_results: maximum number of results. Defaults to 10.\n        page: page of results. Defaults to 1.\n        backend: A single or comma-delimited backends. Defaults to \"auto\".\n\n    Returns:\n        List of dictionaries with news search results.\n    \"\"\"\n```\n***Example***\n```python\nresults = DDGS().news(query=\"sun\", region=\"us-en\", safesearch=\"off\", timelimit=\"m\", page=1, backend=\"auto\")\nprint(results)\n[\n    {\n        \"date\": \"2024-07-03T16:25:22+00:00\",\n        \"title\": \"Murdoch's Sun Endorses Starmer's Labour Day Before UK Vote\",\n        \"body\": \"Rupert Murdoch's Sun newspaper endorsed Keir Starmer and his opposition Labour Party to win the UK general election, a dramatic move in the British media landscape that illustrates the country's shifting political sands.\",\n        \"url\": \"https://www.msn.com/en-us/money/other/murdoch-s-sun-endorses-starmer-s-labour-day-before-uk-vote/ar-BB1plQwl\",\n        \"image\": \"https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1plZil.img?w=2000\u0026h=1333\u0026m=4\u0026q=79\",\n        \"source\": \"Bloomberg on MSN.com\",\n    }, ...\n]\n```\n\n[Go To TOP](#TOP)\n\n## 5. books()\n\n```python\ndef books(\n    query: str,\n    max_results: int | None = 10,\n    page: int = 1,\n    backend: str = \"auto\",\n) -\u003e list[dict[str, str]]:\n    \"\"\"DDGS books metasearch.\n\n    Args:\n        query: news search query.\n        max_results: maximum number of results. Defaults to 10.\n        page: page of results. Defaults to 1.\n        backend: A single or comma-delimited backends. Defaults to \"auto\".\n\n    Returns:\n        List of dictionaries with news search results.\n    \"\"\"\n```\n***Example***\n```python\nresults = DDGS().books(query=\"sea wolf jack london\", page=1, backend=\"auto\")\nprint(results)\n[\n    {\n        'title': 'The Sea-Wolf',\n        'author': 'Jack London',\n        'publisher': 'DigiCat, 2022',\n        'info': 'English [en], .epub, 🚀/zlib, 0.5MB, 📗 Book (unknown)',\n        'url': 'https://annas-archive.li/md5/574f6556f1df6717de4044e36c7c2782',\n        'thumbnail': 'https://s3proxy.cdn-zlib.sk//covers299/collections/userbooks/da4954486be7c2b2b9f70b2aa5bcf01292de3ea510b5656f892821950ded9ada.jpg',\n    }, ...\n]\n```\n\n[Go To TOP](#TOP)\n\n## 6. extract()\n\nFetch a URL and extract its content in various formats.\n\n```python\ndef extract(\n    url: str,\n    fmt: str = \"text_markdown\",\n) -\u003e dict[str, str | bytes]:\n    \"\"\"Fetch a URL and extract its content.\n\n    Args:\n        url: The URL to fetch and extract content from.\n        fmt: Output format:\n            \"text_markdown\" (HTML→Markdown, preserves links/headers/lists),\n            \"text_plain\" (HTML→plain text),\n            \"text_rich\" (HTML→rich text with headers/lists),\n            \"text\" (raw HTML),\n            \"content\" (raw bytes).\n\n    Returns:\n        Dictionary with 'url' and 'content' keys.\n    \"\"\"\n```\n***Examples***\n```python\n# Markdown (default) - preserves links, headers, lists\nresult = DDGS().extract(\"https://example.com\")\nprint(result)\n{\"url\": \"https://example.com\", \"content\": \"# Example Domain\\n\\nThis domain is for use in...\"}\n\n# Plain text\nresult = DDGS().extract(\"https://example.com\", fmt=\"text_plain\")\n\n# Rich text (headers/lists, no link URLs)\nresult = DDGS().extract(\"https://example.com\", fmt=\"text_rich\")\n\n# Raw HTML\nresult = DDGS().extract(\"https://example.com\", fmt=\"text\")\n\n# Raw bytes\nresult = DDGS().extract(\"https://example.com\", fmt=\"content\")\n```\n\n***CLI***\n```bash\nddgs extract -u https://example.com\nddgs extract -u https://example.com -f text_plain\nddgs extract -u https://example.com -f content -o output.json\n```\n\n[Go To TOP](#TOP)\n\n## Disclaimer\n\nThis library is for educational purposes only.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeedy5%2Fddgs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeedy5%2Fddgs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeedy5%2Fddgs/lists"}