2 ms·
I didn't install and run the code, but this appears to be a wrapper for performing a search across these sites via browser...i.e. you specify a provider and the
by danso 11y ago
I didn't install and run the code, but this appears to be a wrapper for performing a search across these sites via browser...i.e. you specify a provider and the query, and the browser pops open with the properly formatted URL, rather than it doing the query, scraping the results and streaming into stdout.
Because I was thinking, there's no way it could be this easy to programmatically search Google:
https://github.com/zquestz/s/blob/master/providers/google/google.go https://github.com/zquestz/s/blob/master/providers/google/go...
func (p *GoogleProvider) BuildURI(q string) string {
return fmt.Sprintf("https://www.google.com/search?q=%s", url.QueryEscape(q))
}
- Cederfjard 11y agoYep, the readme says: >Web search from the terminal. Just opens your default browser.
- danso 11y agoYeah, I was thrown off by the repo description -- "Open a web search in your terminal." -- and just dived into the repo before getting to the README.
- zquestz 11y agoCorrect, I am not a fan of listing the results in the terminal itself. I like the flexibility of it loading in a browser so I can click around after the search. It also makes adding additional search providers much much easier.
- woodruffw 11y agoActually, it is that easy to programmatically search Google. Here's the endpoint: https://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=small&safe=active&q=cats&max-results=10&v=2&alt=json https://ajax.googleapis.com/ajax/services/search/web?v=1.0&r...
- danso 11y agoIt appears to be officially deprecated as of November 2010, though it is perhaps one of those heavily used APIs (such as static charts API) that Google is in no rush to disable https://developers.google.com/web-search/docs/?hl=en https://developers.google.com/web-search/docs/?hl=en
- woodruffw 11y agoAh, I didn't realize it was deprecated. Just about every IRC bot out there uses it ;)
- TeMPOraL 11y agoExcept mine, because I started looking for it post-2010 and got stuck on Google's new whatever-it-is that has complexity beyond imagination and a seriously buggy dev panel.
- samfisher83 11y agoI think all the new ones you need an api key.
- Kerrick 11y agoA while back I created a command line Google search client that actually functions like you were thinking. http://kerrick.github.io/google/ http://kerrick.github.io/google/