Live data from Hacker News

Show HN: Ddgr – search DuckDuckGo from your terminal

github.com

41–50 of 53 posts

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#41

Is there a way to supress the search results if I only want an instant answer? (Ex: If I type in "ip" merely return my IP, not a long list of whois DBs)

Instant results are supported: https://github.com/jarun/ddgr There are a number of "instant" bangs, though it's not clear if these deliver what you want: https://duckduckgo.com/bang?q=instant You can incorporate bang int commandlinee search, though bangs ("!") generally require quoting to avoid bash / shell interpretation.

Ah cool, thanks. Very useful!

I meant more like the various cheatsheets.

(Ex: https://duckduckgo.com/?q=vim+cheat+sheet)

That query would pull up search results, but not the cheat sheet itself. Or if I do "roll 3 dice" I get unicode dice, but not the numerical sum like on the web version.

Anyways, this is really a minor gripe - this is a really cool tool and I appreciate the time you've put into it.

I can see myself using it a lot in the future! :)

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#42
post #38

Is there a way to supress the search results if I only want an instant answer? (Ex: If I type in "ip" merely return my IP, not a long list of whois DBs)

Try ddgr ip --np

Thanks! Looks like

ddgr -n 1 --np ip

gets close

(setting -n to 0 gives a lot of results for some reason?)

Anyways, very small gripe - really like this program. Thanks for your efforts!

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#43
post #32

Earlier quoted context omitted.

In my case BROWSER isn't set. And yet ddgr still found my firefox in another workspace and opened a tab on it. I was just wondering if there's a means to force a terminal/text output from something akin to: ddgr \!ety glaucous

This is inherited from Python's webbrowser module. It would find a GUI browser by default. Please set `BROWSER` to your preferred text-based browser. To force use the GUI browser, use the prompt key `O` or the progrma option `--gb`. As you can see, you can only have it one way (either text or GUI by default) and we kept it the default one.

I haven't messed with text based browsers for a while - do you have a favorite?

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#44
post #38

Earlier quoted context omitted.

Try ddgr ip --np

Thanks! Looks like ddgr -n 1 --np ip gets close (setting -n to 0 gives a lot of results for some reason?) Anyways, very small gripe - really like this program. Thanks for your efforts!

n=0 is the default and results in the default behavior - sow all fetched results in the same page.

Thanks for the compliment! Glad to know you like it.

Update: In fact, there was an option and an extra API to fetch only the instant answer. But it seemed like a overkill because the instant answer comes along with the other results. So I removed that additional API a while back.

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#45
post #32

Earlier quoted context omitted.

This is inherited from Python's webbrowser module. It would find a GUI browser by default. Please set `BROWSER` to your preferred text-based browser. To force use the GUI browser, use the prompt key `O` or the progrma option `--gb`. As you can see, you can only have it one way (either text or GUI by default) and we kept it the default one.

I haven't messed with text based browsers for a while - do you have a favorite?

I use w3m all the time.

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#46
post #40

Why would I use this if I will need a proper browser to view the result anyway?

Strictly speaking, you don't need a browser. You can directly print the content of the results in the terminal with the newspaper library.

Coming to the question - the advantage `ddgr` provides is much more flexibility to the DDG interface or in other words, easy access to parameters you may want to tweak. For example, show only 10 results per page. Please check the program options for more.

One can argue, why not use a text browser? Yes, if scrolling around, pressing tabs to reach a link/field and pressing Enter on it to open the URL/enter text doesn't bother a user (s)he doesn't need `ddgr`.

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#47
post #32

Earlier quoted context omitted.

In my case BROWSER isn't set. And yet ddgr still found my firefox in another workspace and opened a tab on it. I was just wondering if there's a means to force a terminal/text output from something akin to: ddgr \!ety glaucous

This is inherited from Python's webbrowser module. It would find a GUI browser by default. Please set `BROWSER` to your preferred text-based browser. To force use the GUI browser, use the prompt key `O` or the progrma option `--gb`. As you can see, you can only have it one way (either text or GUI by default) and we kept it the default one.

Hi, maybe there's something wrong with my environment, but I installed Lynx via brew, got the location (which brew|pbcopy) then exported the location to an environment variable (export BROWSER=/usr/local/bin/lynx).

But when I select something in ddgr, it says it's opened lynx but the display still just shows a list of 10 results.

If I hit q, it drops me back to ddgr, and then a quit again exits the program.

I don't want to jump to saying the issue is ddgr but was a little surprised.

It's still very useful since a lot of what I do needs images anyways, and it's IMHO silly to try to do GUI browsing in terminal, just thought I'd mention it.

Thanks for being so active in the comments!

(Trying to be extra positive since I know HN can be a little hypercritical, and the people who loved it aren't necessarily going to drop in and say so beyond an upvote :) )

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#49
post #24

Earlier quoted context omitted.

The no tracking policy, and the large amount of built-in features (such as bang-searches). They also don't make life hard for Tor users with endless captcha (there's even an onion service for DDG).

not sure if that still appeals to me.

IMHO the bang commands alone make it really useful

https://duckduckgo.com/bang?q=

Re: Show HN: Ddgr – search DuckDuckGo from your terminal

#50
post #32

Earlier quoted context omitted.

This is inherited from Python's webbrowser module. It would find a GUI browser by default. Please set `BROWSER` to your preferred text-based browser. To force use the GUI browser, use the prompt key `O` or the progrma option `--gb`. As you can see, you can only have it one way (either text or GUI by default) and we kept it the default one.

Hi, maybe there's something wrong with my environment, but I installed Lynx via brew, got the location (which brew|pbcopy) then exported the location to an environment variable (export BROWSER=/usr/local/bin/lynx). But when I select something in ddgr, it says it's opened lynx but the display still just shows a list of 10 results. If I hit q, it drops me back to ddgr, and then a quit again exits the program. I don't w…

Works fine for me. Steps right out of the terminal:

  1. sudo apt install lynx
  2. export BROWSER=lynx
  3. ddgr hello world
  4. Press 1 (to open the first result in lynx)
The site is opened in lynx as expected.
Post reply on HN