A fast, privacy-respecting Python library for DuckDuckGo searches, powered by Rust.
Project description
🦆 Duckduckgo
duckduckgois 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 🗿.
🤔 What does this crate provide?
The library exposes 4 search backends:
- Instant Answer: the official
api.duckduckgo.comJSON endpoint, which returns structured data including abstracts, definitions, direct answers, and related topics. - Lite: the minimal
lite.duckduckgo.comHTML 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.
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.
🔒 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
- DuckDuckGo Instant Answer API
- DuckDuckGo URL Parameters reference
- DuckDuckGo Search Syntax
- DuckDuckGo Help Pages
- Instant Answer API playground
📄 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 ☕.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ddg_rs-0.2.4-cp312-cp312-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: ddg_rs-0.2.4-cp312-cp312-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e56d99f3dd23aa98923e33951aee836111058503b11b38382cb2290b756ede26
|
|
| MD5 |
953ca5da8006da9fbcfb12df1154d281
|
|
| BLAKE2b-256 |
b08ae608b51c2d6bb83df6b149797fd1c944ebaf1fb68721459373cfa5bf559a
|