Package: ddgr
ddgrddgris a cmdline utility to search DuckDuckGo (html version) from the terminal. Whilegoogleris extremely popular among cmdline users, in many forums the need of a similar utility for privacy-aware DuckDuckGo came up.DuckDuckGo Bangsare super-cool too! So here'sddgrfor you!Unlike the web interface, you can specify the number of search results you would like to see per page. It's more convenient than skimming through 30-odd search results per page. The default interface is carefully designed to use minimum space without sacrificing readability.A big advantage ofddgrovergoogleris DuckDuckGo works over the Tor network.ddgrisn't affiliated to DuckDuckGo in any way.Table of contentsFeaturesInstallationDependenciesFrom a package managerFrom sourceRunning standaloneShell completionUsageCmdline optionsConfiguration fileText-based browser integrationColorsExamplesTroubleshootingNotesCollaboratorsIn the PressFeaturesFast and clean; custom colorDesigned for maximum readability at minimum spaceInstant answers (supported by DDG html version)Custom number of results per pageNavigation, browser integrationSearch and option completion scripts (Bash, Fish, Zsh)DuckDuckGo Bangs (along with completion)Open the first result in browser (I'm Feeling Ducky)REPL for continuous searchesKeywords (e.g.filetype:mime,site:somesite.com)Limit search by time, specify region, disable safe searchHTTPS proxy support, optionally disable User AgentDo Not Track set by defaultSupports custom url handler script or cmdline utilityPrivacy-aware (no unconfirmed user data collection)Thoroughly documented, man page with examplesMinimal dependenciesInstallationDependenciesddgrrequires Python 3.8 or later. Only the latest patch release of each minor version is supported.To copy url to clipboard at the omniprompt,ddgrlooks forxselorxcliportermux-clipboard-set(in the same order) on Linux,pbcopy(default installed) on OS X,clip(default installed) on Windows andclipboard(default installed) on Haiku. It also supports GNU Screen and tmux copy-paste buffers in the absence of X11.Note: v1.1 and below require the Python3requestslibrary to make HTTPS requests. This dependency is removed in the later releases.From a package managerInstallddgrfrom your package manager. If the version available is dated try an alternative installation method.Packaging status (expand)Unlisted packagers:●Awesome(awesome -install jarun/ddgr)●PyPI(pip3 install ddgr)●Snap Store(snap install ddgr)●Source Mage(cast ddgr)● Termux (pip3 install ddgr)From sourceIf you have git installed, clone this repository. Otherwise download thelatest stable releaseordevelopment version.To install to the default location (/usr/local):$ sudo make installTo removeddgrand associated docs, run$ sudo make uninstallPREFIXis supported, in case you want to install to a different location.Running standaloneddgris a standalone executable (and can run even on environments like Termux). From the containing directory:$ ./ddgrShell completionSearch keyword and option completion scripts for Bash, Fish and Zsh can be found in respective subdirectories ofauto-completion/. Please refer to your shell's manual for installation instructions.UsageCmdline optionsusage: ddgr [-h] [-n N] [-r REG] [--colorize [{auto,always,never}]] [-C]
            [--colors COLORS] [-j] [-t SPAN] [-w SITE] [-x] [-p URI]
            [--unsafe] [--noua] [--json] [--gb] [--np] [--url-handler UTIL]
            [--show-browser-logs] [-v] [-d]
            [KEYWORD [KEYWORD ...]]

DuckDuckGo from the terminal.

positional arguments:
  KEYWORD               search keywords

optional arguments:
  -h, --help            show this help message and exit
  -n N, --num N         show N (0<=N<=25) results per page (default 10); N=0
                        shows actual number of results fetched per page
  -r REG, --reg REG     region-specific search e.g. 'us-en' for US (default);
                        visit https://duckduckgo.com/params
  --colorize [{auto,always,never}]
                        whether to colorize output; defaults to 'auto', which
                        enables color when stdout is a tty device; using
                        --colorize without an argument is equivalent to
                        --colorize=always
  -C, --nocolor         equivalent to --colorize=never
  --colors COLORS       set output colors (see man page for details)
  -j, --ducky           open the first result in a web browser; implies --np
  -t SPAN, --time SPAN  time limit search [d (1 day), w (1 wk), m (1 month), y (1 year)]
  -w SITE, --site SITE  search sites using DuckDuckGo
  -x, --expand          Show complete url in search results
  -p URI, --proxy URI   tunnel traffic through an HTTPS proxy; URI format:
                        [http[s]://][user:pwd@]host[:port]
  --unsafe              disable safe search
  --noua                disable user agent
  --json                output in JSON format; implies --np
  --gb, --gui-browser   open a bang directly in gui browser
  --np, --noprompt      perform search and exit, do not prompt
  --rev, --reverse      list entries in reversed order
  --url-handler UTIL    custom script or cli utility to open results
  --show-browser-logs   do not suppress browser output (stdout and stderr)
  -v, --version         show program's version number and exit
  -d, --debug           enable debugging

omniprompt keys:
  n, p, f               fetch the next, prev or first set of search results
  index                 open the result corresponding to index in browser
  o [index|range|a ...] open space-separated result indices, ranges or all
  O [index|range|a ...] like key 'o', but try to open in a GUI browser
  d keywords            new DDG search for 'keywords' with original options
                        should be used to search omniprompt keys and indices
  x                     toggle url expansion
  c index               copy url to clipboard
  q, ^D, double Enter   exit ddgr
  ?                     show omniprompt help
  *                     other inputs are considered as new search keywordsConfiguration fileddgrdoesn't have any! Use aliases, environment variables and auto-completion scripts.Text-based browser integrationddgrworks out of the box with several text-based browsers if theBROWSERenvironment variable is set. For instance,$ export BROWSER=w3mor for one-time use,$ BROWSER=w3m ddgr queryDue to certain graphical browsers spewing messages to the console,ddgrsuppresses browser output by default unlessBROWSERis set to one of the known text-based browsers: currentlyelinks,links,lynx,w3morwww-browser. If you use a different text-based browser, you will need to explicitly enable browser output with the--show-browser-logsoption. If you believe your browser is popular enough, please submit an issue or pull request and we will consider whitelisting it. See the man page for more details on--show-browser-logs.If you need to use a GUI browser withBROWSERset, use the omniprompt keyO.ddgrwill try to ignore text-based browsers and invoke a GUI browser. Browser logs are always suppressed withO.ColorsThe color configuration is similar to that ofgooglercolors. The default color string isoCdgxy.ddgrrecognizes the environment variableDDGR_COLORS. Details are available in theddgrman page.ExamplesDuckDuckGohello world:$ ddgr hello worldI'm Feeling Duckysearch:$ ddgr -j lucky ducksDuckDuckGo Bangsearchhello worldin Wikipedia:$ ddgr !w hello world
$ ddgr \!w hello world // in (some) shells (e.g. bash, zsh, tcsh) '!' character need to be escapedBangs work at the omniprompt too. To look up bangs, visithttps://duckduckgo.com/bang?#bangs-list.Bang aliasto fire from the cmdline, open results in a GUI browser and exit:alias bang='ddgr --gb --np'
$ bang !w hello world
$ bang \!w hello world // in (some) shells (e.g. bash, zsh, tcsh) '!' character need to be escapedWebsite specificsearch:$ ddgr -w amazon.com digital cameraSite specific search continues at omniprompt.Search for aspecific file type:$ ddgr instrumental filetype:mp3Fetch results on IPL cricket fromIndiainEnglish:$ ddgr -r in-en IPL cricketTo find your region parameter token visithttps://duckduckgo.com/params.Searchquoted text:$ ddgr it\'s a \"beautiful world\" in springShowcomplete urlsin search results (instead of only domain name):$ ddgr -x ddgrUse acustom color scheme, e.g., one warm color scheme designed for Solarized Dark:$ ddgr --colors bjdxxy hello world
$ DDGR_COLORS=bjdxxy ddgr hello worldTunnel traffic through anHTTPS proxy, e.g., a local Privoxy instance listening on port 8118:$ ddgr --proxy localhost:8118 hello worldBy default the environment variablehttps_proxy(orHTTPS_PROXY) is used, if defined.Look upn,p,o,O,q,d keywordsor a result index at theomniprompt: as the omniprompt recognizes these keys or index strings as commands, you need to prefix them withd, e.g.,d n
d g keywords
d 1TroubleshootingSome users have reported problems with a colored omniprompt (refer to issue#40) with iTerm2 on OS X. To force a plain omniprompt:export DISABLE_PROMPT_COLOR=1NotesThe Albert Launcher python plugins repo
(awesome-albert-plugins)
includes suggestions-enabled search plugins for a variety of websites usingddgr. Refer to the latter for demos and usage instructions.CollaboratorsArun Prakash JanaJohnathan JenkinsSZ LinAlex GontarCopyright © 2016-2023Arun Prakash JanaIn the PressFossbytesHacker NewsInformation Security SquadLinOxideOMG! Ubuntu!Tecmint