Duckduckgo.com search results
Project description
Duckduckgo_search
Duckduckgo.com search results.
Dependencies
lxml, requests
Install
pip install -U duckduckgo_search
Usage
WARNING! : The site duckduckgo.com gives an error when making frequent repeated requests.
If the function returns an error, wait 15 seconds.
Approximate time intervals depending on the number of requested results:
number of results requested | interval between requests |
---|---|
1 <= max_results <=10 | 1 sec |
10 <= max_results <= 20 | 3 sec |
20 <= max_results <= 40 | 5 sec |
40 <= max_results <= 200 | >= 10 sec |
from duckduckgo_search import ddg
ddg(keywords, region='wt-wt', safesearch='Moderate', time=None, max_results=30, **kwargs):
'''
DuckDuckGo search
Query parameters, link: https://duckduckgo.com/params:
keywords: keywords for query;
safesearch: On (kp = 1), Moderate (kp = -1), Off (kp = -2);
region: country of results - wt-wt (Global), us-en, uk-en, ru-ru, etc.;
time: 'd' (day), 'w' (week), 'm' (month), 'y' (year), or 'year-month-date..year-month-date';
max_results = 30 gives a number of results not less than 30,
maximum DDG gives out about 200 results.
'''
Returns
[{'title': title of result,
'href': href of result,
'body': body of result,},
{'title': title of result,
'href': href of result,
'body': body of result,}, ...]
Example
keywords = 'google'
results = ddg(keywords, region='wt-wt', safesearch='Moderate', time='y', max_results=2)
print(results)
[
{
'title': 'Google',
'href': 'http://www.l.google.com/',
'body': "Google has many special features to help you find exactly what you're looking for. Advertising Programs Business Solutions About Google."
},
{
'title': 'Google - Home | Facebook',
'href': 'https://www.facebook.com/Google/',
'body': "Google, Mountain View, CA. 28M likes · 52,285 talking about this · 611 were here. Organizing the world's information and making it universally accessible... See actions taken by the people who manage and post content. Google Inc. is responsible for this Page."
},
]
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 Distribution
duckduckgo_search-0.6.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file duckduckgo_search-0.6.tar.gz
.
File metadata
- Download URL: duckduckgo_search-0.6.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3a23c396abbf6e25ef929e6ca58ca0dd9fc5b98b87d65c7d7efe181daaa40c7 |
|
MD5 | 216ec9254605fd388d6a5b1556997bb9 |
|
BLAKE2b-256 | 5806bac4e3eaff8a7f492614a7fcf635b3447c7a0d64d171c643f7387ad9c1f8 |
File details
Details for the file duckduckgo_search-0.6-py3-none-any.whl
.
File metadata
- Download URL: duckduckgo_search-0.6-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77cd19cbc4870d6acf3ea66c62cd20c1a1eeffed2687ea5a0f6b4dbd29e13052 |
|
MD5 | 8477829505411a24f4a1ee831b50402e |
|
BLAKE2b-256 | 977b036a05801a011bc8fd4882cef54e42e69b9e4721b804f1be9efdf0a94653 |