Skip to main content

🦆 Duckduckgo

DDG

Crates.io Docs.rs npm PyPI MIT License

duckduckgo is a multi-language toolkit for searching DuckDuckGo from code or the command line. The core is written entirely in Rust and compiled to a native extension, so Python and Node.js callers enjoy the same performance and correctness guarantees as the Rust library, with no runtime dependencies beyond the native extension itself 🗿.

🐧 Linux (Recommended) 🪟 Windows 🐳 Docker 📦 Linux Distros
ddg-tui-linux ddg-tui-windows ddg-tui-linux ddg-tui-linux
Download ddg binary Download ddg.exe binary docker pull wiseaidev/ddg apt install ddg-rs (TODO: Publish)
cargo install duckduckgo --features rust-binary cargo install duckduckgo --features rust-binary docker run -it wiseaidev/ddg dnf install ddg-rs (TODO: Publish)
ddg ← launches TUI ddg ← launches TUI Read DOCKER.md Read PACKAGING.md

🤔 What does this crate provide?

The library exposes 4 search backends:

  • Instant Answer: the official api.duckduckgo.com JSON endpoint, which returns structured data including abstracts, definitions, direct answers, and related topics.
  • Lite: the minimal lite.duckduckgo.com HTML interface, which returns plain text results without JavaScript.
  • Images: paginated image results via duckduckgo.com/i.js.
  • News: paginated news articles via duckduckgo.com/news.js.

A comprehensive SearchParams builder covers every documented DuckDuckGo URL parameter: region, safe-search, theme, colours, fonts, header behaviour, and more.

🦀 Rust

The Rust crate is available on crates.io. For a complete API reference, installation guide, and worked examples, visit the Rust Usage Guide.

The crate ships the following Cargo features:

Feature Description
rust-binary Enables the standalone ddg terminal CLI executable
python Python extension module via pyo3
node Node.js native add-on via napi-derive

🌐 WebAssembly (WASM)

duckduckgo natively supports the wasm32-unknown-unknown target! Because it uses reqwest under the hood, it seamlessly switches to the fetch API when deployed in the browser.

To resolve CORS issues, the library uses a 4-tier strategy: direct DDG calls, optional self-hosted or public proxies, and a guaranteed Wikipedia fallback. This ensures your search always returns a result, even without a proxy.

This makes it perfect for client-side search inside Rust frontend frameworks like Yew, Dioxus, and Leptos. We actively use this technique in the llm/examples/chat application.

For CORS considerations, code examples, and usage details, read the WASM usage guide.

🐍 Python

The Python bindings are published to PyPI as ddg-rs and can be installed with pip install ddg-rs. The package is built with maturin and ships pre-compiled wheels for the major CPython versions.

The Python module exposes the Browser, SearchParams, LiteSearchResult, ImageResult, and NewsResult types. All network methods are synchronous - they drive an embedded Tokio runtime so callers do not need an event loop.

For installation instructions, configuration options, and full method signatures, read the Python usage guide.

🟩 Node.js

The Node.js bindings are published to npm as ddg-rs and can be installed with npm install ddg-rs. The package is built with napi-rs and ships a pre-compiled .node add-on.

The module exposes the Browser class, SearchParams builder, and plain object result types (LiteSearchResult, ImageResult, NewsResult, InstantAnswerResponse). Like the Python API, all network calls are synchronous within the binding.

For installation instructions, type definitions, and examples, read the Node.js usage guide.

💻 Command-line interface

The ddg binary supports full-text, image, news, and Instant Answer searches directly from the terminal. It accepts a rich set of options including user-agent selection, cookie storage, HTTP proxy support, safe-search, and a choice of result backends.

For the full option reference and usage examples, see the CLI documentation or run ddg --help after installing with cargo install duckduckgo --features rust-binary.

🐳 Docker Deployment

duckduckgo is completely containerized and includes the CLI and TUI pre-installed.

For instructions on pulling the container and usage, refer to the Docker usage guide.

📦 Linux Distros Packaging (TODO)

For system-wide installations that rely on native package managers, the project includes .deb and .rpm packaging pipelines. This enables installation via apt (Debian/Ubuntu/Kali) and dnf (RedHat/Fedora).

For packaging instructions and build flows, refer to the Linux Packaging guide.

🔒 Privacy

DuckDuckGo does not track users or personalise results. This library makes direct HTTPS requests to the same public endpoints that the browser does. No API key, account, or authentication token is required.

For more information about DuckDuckGo's privacy practices, visit duckduckgo.com/privacy.

📚 Further reading

📄 License

Licensed under the MIT License.

⭐ Star us

If you use or enjoy this toolkit, please leave us a star on GitHub! It helps others discover the project and keeps the momentum going and the coffee flowing ☕.

Star History Chart

Metadata

Release files for ddg-rs 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for ddg-rs 0.3.5
File Interpreter ABI Platform Actions
ddg_rs-0.3.5-cp314-cp314-manylinux_2_38_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ x86-64 Details for ddg_rs-0.3.5-cp314-cp314-manylinux_2_38_x86_64.whl

Release files / ddg_rs-0.3.5-cp314-cp314-manylinux_2_38_x86_64.whl

Download URL ddg_rs-0.3.5-cp314-cp314-manylinux_2_38_x86_64.whl
Size 3.4 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
718dad67db1c6539be114380c3157ebeac721955bc0e430961e5bc73b54b0831
BLAKE2b-256 checksum
How to use checksums
ad046f9c59fed4e9b6e9d3c1b1e98298ae1f4c66e19efd542d016ab69fae42b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ddg-rs 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page