DuckDuck Search Library
DuckDuck Search Library is a Python library that allows you to perform searches using DuckDuckGo. With a simple and clean API, you can quickly and easily retrieve relevant documents and links from the internet. The library supports features like rate limiting, domain filtering, and optional answer retrieval directly from DuckDuckGo.
Features
-
Easy Integration: Provides a simple and intuitive API for performing searches.
-
Rate Limiting: Built-in rate limiting helps to avoid making requests too frequently.
-
Domain Filtering: Restrict search results to a specific domain if required.
-
Optional Answer Retrieval: Optionally fetch direct answers from DuckDuckGo.
-
Flexible Configuration: Customizable parameters such as region, safe search settings, time limits, and more.
-
Python 3.7+ Compatible: Designed to work with modern versions of Python.
Installation
You can install the library via pip:
From PIP
pip install duckducksearch
From Source
pip install git+https://github.com/bes-dev/duckducksearch.git
Usage
from duckduck_search_lib import DuckDuckSearch
# Initialize the searcher with your desired configuration.
searcher = DuckDuckSearch(
top_k=10,
max_results=20,
region="wt-wt",
safesearch="moderate",
allowed_domain="", # Leave empty for no domain restriction
use_answers=False # Set to True if you want to retrieve direct answers from DuckDuckGo
)
# Define your search query and number of results to retrieve.
query = "What is Python?"
num_results = 5
# Perform the search.
results = searcher.search(query, num_results)
# Output the results.
print("Documents:")
for doc in results["documents"]:
print(f"Title: {doc.title}")
print(f"Content: {doc.content}")
print(f"Link: {doc.link}")
print("------------")
print("Links:")
for link in results["links"]:
print(link)
Metadata
Release files for duckducksearch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| duckducksearch-0.1.0.tar.gz | 7.9 kB | Without provenance | Details for duckducksearch-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| duckducksearch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for duckducksearch-0.1.0-py3-none-any.whl |
Total release size: 16.1 kB
Release files / duckducksearch-0.1.0.tar.gz
| Download URL | duckducksearch-0.1.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e08d68106670a9ca1121734b80981f45f52a65ab5037f5ff1f0f1c683111898d
|
|
BLAKE2b-256 checksum How to use checksums |
7a85de8366eded75220cf87a6eed037d3066b689f6542bea8bc9f4053ebbc29c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / duckducksearch-0.1.0-py3-none-any.whl
| Download URL | duckducksearch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcdf10de0d787ce3deb04e61c5aaa34b6f1565805fdd7884ea9b63a00194c42a
|
|
BLAKE2b-256 checksum How to use checksums |
1363344ea5bbd594bd9092ec2728cb05c96301ad7a27b620b801346fe06b3d2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for duckducksearch 0.1.0
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.