Skip to main content

Duckduckgo.com search results

Project description

Python >= 3.6

Duckduckgo_search

Duckduckgo.com search results.

Dependencies

lxml, requests

Install

pip install -U duckduckgo_search

Usage

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: depends on the keyword, the 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

This version

0.5

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.5.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

duckduckgo_search-0.5-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file duckduckgo_search-0.5.tar.gz.

File metadata

  • Download URL: duckduckgo_search-0.5.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for duckduckgo_search-0.5.tar.gz
Algorithm Hash digest
SHA256 b3a4aa50249462e13253c91bbcc32d3668c45a9f87acd5228742f1761a13286c
MD5 7ea9fcc20d319899432d334b62d328c8
BLAKE2b-256 c3a2e1e5fb1f5f121261b536e34dc62c6e27cb1c4db6ec63c127a3305324d637

See more details on using hashes here.

File details

Details for the file duckduckgo_search-0.5-py3-none-any.whl.

File metadata

  • Download URL: duckduckgo_search-0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for duckduckgo_search-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2a7810f4d8946e2f4bd4f923e43c67eb15532dbbe8b69d43639ab84f2cb13fce
MD5 920e7df6c8be18f74a82e4ab9f5e1371
BLAKE2b-256 0db25e1261046d596ceab63cfc1d4c8da1bc65cc11b178a88d6fab13134c9466

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page