Duckduckgo.com search results
Project description
Duckduckgo_search
Duckduckgo.com search results.
Dependencies
lxml, requests
Install
pip install -U duckduckgo_search
Usage
WARNING!: set the delay between function calls to 2 seconds to avoid site error.
If the function returns an error, wait 15 seconds.
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.7.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for duckduckgo_search-0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f26124c5d71b8e296a6827c9f1b97e2d45440d4d2baa54d7bb1ad111370112c |
|
MD5 | 39d7cf45f999c54fa8273e99e4e87d65 |
|
BLAKE2b-256 | f99179af114a61065c4fd74399af68835af83b986e2d789f37e54111dc884004 |