DuckDuckGo zero-click info API for your command-line
Switch branches/tags
Nothing to show
Latest commit 3bb0830 Jun 28, 2014 @justinls justinls Merge pull request #5 from dkasak/patch-1
Specify python2 explicitly
Failed to load latest commit information.



Duck Duck Go zero-click api for your command-line


$ pip install ddg

or from the source:

$ python install


ddg [-h] [-b] [-d] [-j] [-l] [-s] [-u] [query [query ...]] zero-click api for your command-line

positional arguments:
query the search query
optional arguments:
-h, --help show this help message and exit
-b, --bang open the !bang redirect url in a new browser tab
-d, --define return the definition result
-j, --json return the zero-click info api json response
-l, --lucky open the result url in a new browser tab
-s, --search launch a DuckDuckGo search in a new browser tab
-u, --url return the result url


Call ddg from your command line to access the Duck Duck Go Zero-Click Info API

$ddg red-black tree
A red–black tree is a type of self-balancing binary search tree, a data structure
used in computer science, typically used to implement associative arrays.

Get the url of the answer source

$ ddg red-black tree -u

Combinining flags behaves as expected

$ ddg schnauzer -d -u

Launch a !Bang redirect in your web browser with the -b flag

Launch a query on Wolfram Alpha

$ ddg wa integral of sin x / x from negative inf to inf -b

Launch a search on Stack Overflow

$ ddg so [c++11] lambda return values -b

Launch a search on Duck Duck Go with -s

$ ddg Lord of the Rings -s

Launch the result url directly with -l

$ ddg python webbrowser -l

ddg plays nice with other utilities in your shell

$ echo "shark" | ddg -dl
$ ddg welsh corgi -u | pbcopy
$ ls | ddg -du

Use -j to output the json response from the API

$ ddg simpsons characters -j >> file.txt


The duckduckgo module is a modification from
Original duckduckgo module source from (outdated)