Giter VIP home page Giter VIP logo

s's Introduction

s

License ReportCard Build Release

Web search from the terminal. Just opens in your browser.

Usage:
  s <query> [flags]

Flags:
  -b, --binary string       binary to launch search URI
  -c, --cert string         path to cert.pem for TLS
      --completion string   completion script for bash, zsh, fish or powershell
  -h, --help                help for s
  -k, --key string          path to key.pem for TLS
  -l, --list-providers      list supported providers
      --list-tags           list available tags
  -o, --output              output only mode
      --port int            server port (default 8080)
  -p, --provider string     search provider (default "presearch")
  -s, --server              launch web server
  -t, --tag string          search tag
  -v, --verbose             verbose mode
      --version             display version

Install

go get -v github.com/zquestz/s
cd $GOPATH/src/github.com/zquestz/s
make
make install

Alternatively, you can use Homebrew:

brew install s-search

Examples

Search for puppies on presearch.

s puppies

Search for dragonflies on google.

s -p google dragonflies

Search for a wifi router on amazon

s -p amazon wifi router

Search for rhinos on wikipedia

s -p wikipedia rhinos

Search providers tagged "video" for muppets.

s -t video muppets

Provider/Tag Expansion

We can do partial matching of provider and tag names. This searches Facebook for hamsters.

s -p fa hamsters

Or toasters on amazon.

s -p am toasters

This searches "tech-news" tagged providers for ssd info.

s -t te ssd

Or shopping sites for blankets.

s -t sh blankets

Provider/Tag Autocompletion

Autocompletion is supported for providers and tags. To set up autocompletion:

Bash Linux

s --completion bash > /etc/bash_completion.d/s

Bash MacOS

s --completion bash > /usr/local/etc/bash_completion.d/s

Zsh

Generate a _s completion script and put it somewhere in your $fpath:

s --completion zsh > /usr/local/share/zsh/site-functions/_s

Fish

s --completion fish > ~/.config/fish/completions/s.fish

Powershell

(& s --completion powershell) | Out-String | Invoke-Expression

Advanced

Setup an alias in your .profile for your favorite providers.

alias sa="s -p amazon"
alias sw="s -p wikipedia"

Use w3m to find cats instead of just your default browser.

s -b w3m cats

Search for conspiracy theories in incognito mode.

s -b "chromium --incognito" conspiracy theories
s -b "firefox --private-window" conspiracy theories

Search in a specific subreddit.

s -p reddit /r/cscareerquestions best startups.

Server Mode

A web interface is also provided. Just pass the -s flag.

Start a server on port 8080 (default).

s -s

Start a server with TLS on port 8443.

s -s -c /path/to/cert.pem -k /path/to/key.pem --port 8443

Feel free to try it out at https://jumps.io/.

Configuration

To setup your own default configuration just create ~/.config/s/config. The configuration file is in UCL format.

For more information about UCL visit: https://github.com/vstakhov/libucl

The following keys are supported:

  • blacklist (array of providers to exclude)
  • binary (binary to launch search URI)
  • cert (path to cert.pem for TLS)
  • customProviders (array of custom providers)
  • key (path to key.pem for TLS)
  • output (output only mode)
  • port (server port)
  • provider (search provider)
  • tag (search tag)
  • verbose (verbose mode)
  • whitelist (array of providers to include)

Set your default provider to duckduckgo:

provider: duckduckgo

To only search a few providers:

whitelist: [google, amazon, wikipedia]

To exclude providers you don't need:

blacklist: [dumpert]

To add a custom provider:

customProviders [
  {
    name: example
    url: "http://example.com?q=%s"
    tags: [example]
  }
]

Custom providers require a few things:

  • An alphanumeric name. ^[a-zA-Z0-9_]*$
  • A %s token for the query string.
  • A valid URL scheme.

Supported Providers

  • 500px
  • 8tracks
  • aliexpress
  • allocine
  • amazon
  • archpkg
  • archwiki
  • ardmediathek
  • arstechnica
  • arxiv
  • atmospherejs
  • aur
  • baidu
  • bandcamp
  • bgr
  • bigbasket
  • bing
  • brave
  • buzzfeed
  • cnn
  • codepen
  • coursera
  • cplusplus
  • cppreference
  • crates
  • crunchyroll
  • debianpkg
  • dict
  • diigo
  • dockerhub
  • dribbble
  • duckduckgo
  • dumpert
  • ecosia
  • engadget
  • explainshell
  • facebook
  • flake8rules
  • flickr
  • flipkart
  • foursquare
  • freebsdman
  • freshports
  • gibiru
  • giphy
  • gist
  • github
  • gmail
  • go
  • godoc
  • goodreads
  • google
  • googledocs
  • hackernews
  • idealo
  • ietf
  • ifttt
  • imdb
  • imgur
  • instagram
  • kagi
  • kaufda
  • libgen
  • linkedin
  • lmgtfy
  • macports
  • magnetdl
  • mdn
  • medium
  • metacpan
  • msdn
  • naver
  • netflix
  • nhaccuatui
  • npm
  • npr
  • nvd
  • openbsdman
  • overstock
  • packagist
  • perplexity
  • presearch
  • protondb
  • phandroid
  • phind
  • php
  • pinterest
  • postgresql
  • pydoc
  • pypi
  • python
  • quora
  • qwant
  • reddit
  • regex
  • rottentomatoes
  • rubygems
  • shodan
  • soundcloud
  • spotify
  • stackoverflow
  • steam
  • taobao
  • thepiratebay
  • theregister
  • twitchtv
  • twitter
  • ultimateguitar
  • unity3d
  • vimeo
  • wikipedia
  • wolframalpha
  • yahoo
  • yandex
  • youtube
  • zdf
  • zhihu

Contributors

License

s is released under the MIT license.

s's People

Contributors

akb avatar chrisfinazzo avatar delucks avatar dependabot[bot] avatar fnky avatar huangnauh avatar keizerdev avatar kianmeng avatar knarfeh avatar leegeng avatar lkhamsurenl avatar mickythump avatar mstruebing avatar mxlxm avatar notmike avatar p-v avatar paulp avatar pborzenkov avatar raphaelstolt avatar rpdelaney avatar shevabam avatar shizeeg avatar streeck avatar thatisgeek avatar vccortez avatar vthiery avatar xav-b avatar xoro avatar yosmoc avatar zquestz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s's Issues

GLX missing

While performing any sort of query i get the output:

Xlib: extension "GLX" missing on display ":0".

Support for Duckduckgo !bangs with a leading `!`?

Great program!

I used Duckduckgo as my only primary engine (with !bangs to search other websites/search engines if necessary (example: !i poo party to search Google Images for "poo party").

I have noticed that !bangs work, but only if the exclamation point (the !bang) is placed after the letter string, not before. Example: s !w giraffe sends "weechat giraffe" to DDG, whereas s w! giraffe searches wikipedia for "giraffe", as intended. In the browser, either works.

I've been using !bangs with the exclamation point before the string for three years, and it will be difficult to retrain my muscle memory. Would it be possible to implement this feature, or might there be a way to hack it in?

For the time being, I'll try to get used to putting the ! after the string.

Thanks!

Passing strings as arguments

If you wanted to search github with query params, is that possible?

Some examples:

# works with no params
❯ s zquest -p github -o
https://github.com/search?utf8=✓&q=zquest
# doesnt work
❯ s zquestz extension:go -p github -o
https://github.com/search?utf8=✓&q=zquestz+extension%3Ago

# doesnt work with quotes around query string
~
❯ s "zquestz extension:go" -p github -o
https://github.com/search?utf8=✓&q=zquestz+extension%3Ago

# works without `utf8`
~
❯ open https://github.com/search?q=zquestz+extension%3Ago

Thanks for sharing your project.

"Command Not Found"

Yeah I'm new to Go so bear with me. I installed the Go install stuff and set my $GOPATH, then followed the instructions in the readme and I am still getting "command not found" when I try to run it. The make commands appeared to work but idk why the s command isn't. I added the $GOPATH to my dotfiles, tried a fresh terminal window, but nah.

Doing this on a Mac running El Crappytan.

Support multiple languages

It would be great if you could configure s to search Google, Wikipedia (and every site which offers more than one language) in a different language than english. Perhaps you could use a config file to save a pre-selection or use a switch like "s foo -lang=de", since -l is already used.

Support homebrew

I would like to install this package via homebrew in OSX.
I'm now working to support this in here.

I sent the pull request, and got 2 CI errors.

==> audit problems
s:
 * Formula name conflicts with homebrew/emacs/s
 * GitHub repository too new (<30 days old)

Formula name conflicts with homebrew/emacs/s

homebrew official account has homebrew-emacs repository to manage the emacs dependencies. The package name 's' is already used in this Formula repository. So, we have to use another name. What name do you want to use to install?

$ brew install xxx

GitHub repository too new (<30 days old)

s is quite new project. So I will just wait few days and send pull request again.

Homebrew

The automated process for updating Homebrew formulas (brew bump-formula-pr) fails during its audit phase for v0.5.14. Specifically, the use of go_resource is now deprecated. Per the error below, is it possible to implement Go vendoring so that we can pull the latest version automatically?

screen shot 2018-12-22 at 10 33 57 pm

Dependencies not vendored

We need to vendor all 3rd party dependencies. Ideally we use gvt for managing deps moving forward. A PR adding this would be great, otherwise I can get to it soon.

[feature request] Match shortest unique initial substring of providers

I would like to allow matching providers based off of the shortest unique inital substring of the provider's text.

Example:

s -p a -> s -p amazon
s -p d -> d could match digg, dockerhub or duckduckgo
s -p duc -> s -p duckduckgo

I will most likely implement this in a day or so, just thought I would open an issue for the eventual PR if you want that feature.

License vs. "all rights reserved"

You have a very permissive license in the file LICENSE, but the bottom of README.md says "all rights reserved". Would you mind removing the obsolete one, whichever that is?

Install instructions on Windows (8.1)

I have some trouble installing on Windows (no make tools, newest I can find are from 2006). So I tried the built s.exe, however I get the following error:

[Error] Failed to stat Stdin: GetFileInformationByHandle /dev/stdin: Incorrect function.

Could you provide install instruction for Windows? Perhaps something to add to the README.md?

s fails silently

I know this is not very helpful, but when I try to search with s, nothing happens. If I run with -v, I get the search url. If I run with --verson I get the version s 0.5.6. In all cases, exit code 0.

Merge contributor

I see your timezone is the opposite of mine. I can help you merging the PRs when your not online so we won't get huge merge conflicts. If you inform me correctly what you want with the project and what not I'm pretty sure I can do the job for you if you want. @zquestz

Compiling is failing

Compiling is failing due to a cobra error (github.com/spf13/cobra):
make
go build .

github.com/spf13/cobra

../../spf13/cobra/bash_completions.go:22:24: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:383:26: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:425:24: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:437:27: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:475:25: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:486:20: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:501:38: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:527:21: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:564:28: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:589:29: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:589:29: too many errors
make: *** [Makefile:9: all] Error 2

Getting an ar error

When running go get -v github.com/zquestz/s on Arch Linux I get:

github.com/zquestz/s (download)
github.com/spf13/cobra (download)
github.com/spf13/pflag (download)
github.com/spf13/pflag
github.com/zquestz/s/launcher
# github.com/zquestz/s/launcher
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers
# github.com/zquestz/s/providers
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/amazon
github.com/zquestz/s/providers/bing
github.com/zquestz/s/providers/digg
github.com/zquestz/s/providers/dockerhub
github.com/zquestz/s/providers/duckduckgo
github.com/zquestz/s/providers/gist
github.com/zquestz/s/providers/github
# github.com/zquestz/s/providers/bing
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/go
# github.com/zquestz/s/providers/duckduckgo
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/google
# github.com/zquestz/s/providers/gist
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/npm
# github.com/zquestz/s/providers/dockerhub
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/npmsearch
# github.com/zquestz/s/providers/digg
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/amazon
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/pinterest
# github.com/zquestz/s/providers/github
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/reddit
# github.com/zquestz/s/providers/go
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/soundcloud
github.com/zquestz/s/providers/stackoverflow
# github.com/zquestz/s/providers/google
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/twitter
# github.com/zquestz/s/providers/pinterest
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/wikipedia
# github.com/zquestz/s/providers/npm
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/npmsearch
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/providers/yahoo
github.com/zquestz/s/providers/youtube
# github.com/zquestz/s/providers/reddit
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/stackoverflow
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/twitter
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/yahoo
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/soundcloud
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/wikipedia
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/zquestz/s/providers/youtube
ar: `u' modifier ignored since `D' is the default (see `U')
# github.com/spf13/pflag
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/spf13/cobra
# github.com/spf13/cobra
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s/cmd
# github.com/zquestz/s/cmd
ar: `u' modifier ignored since `D' is the default (see `U')
github.com/zquestz/s
# github.com/zquestz/s
ar: `u' modifier ignored since `D' is the default (see `U')

It works, tho

Cant specify binary using snap

Hey,
I'm trying to use s-search -b w3m but I get the message: executable "w3m" not found in $PATH which it is.
I've also tried to set the config file in .config/s/config with "binary: /usr/bin/w3m"
With no luck, so far.
Is this a problem of the snap packaged version or am I doing something wrong?

Btw, I've also tried to use firefox instead with no luck, I get the same issue if I try -b with any browser.
Thanks,

Issues with makefile (bad form)

sudo should not be in there, let the build fail or tell the user they need sudo.
and why not just go install? the $GOPATH should already be defined by the user.

Zsh completion not working

Hi, I noticed that in the latest update zsh completion is provided by generating it through a flag. I did so, and placed it in a _s file inside my $fpath with other completion files, and made it executable.

However, it's not recognising tab-completion; other files inside the same dir in $fpath are working.

binary file seems too big

I install s-search via home brew, 9.4M.

$ pwd
/usr/local/Cellar/s-search/0.5.11/bin
$ s --version
s 0.5.11
$ ll
total 9.4M
-r-xr-xr-x 1 jerry admin 9.4M Aug 27 08:57 s*

How s search is compared to Surfraw ?

Hi,
I 'm confused if I should use s or surfraw . There is no comparison elsewhere!
Could you provide some features of s (pros and cons if possible) compared to surfraw or other CLI search tools (ddgr , googler .....)

EDIT: typos :(

subl: command not found

I installed this package using brew and I try to use it and it tells me bash: subl: command not found I havent installed sublime text or anything like that and I cant find an alias so Im not sure whats going on.

同学,您这个项目引入了153个开源组件,存在1个漏洞,辛苦升级一下

检测到 zquestz/s 一共引入了153个开源组件,存在1个漏洞

漏洞标题:miekg Go DNS package 安全特征问题漏洞
缺陷组件:github.com/miekg/[email protected]
漏洞编号:CVE-2019-19794
漏洞描述:miekg Go DNS package是一款DNS服务器软件包。
miekg Go DNS package 1.1.25之前版本(用在CoreDNS 1.6.6之前版本和其他产品)中存在安全漏洞,该漏洞源于程序没有正确生成随机数。攻击者可利用该漏洞伪造响应。
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2019-45898
影响范围:(∞, 1.1.25)
最小修复版本:1.1.25
缺陷组件引入路径:github.com/zquestz/s@->github.com/miekg/[email protected]

另外还有几个漏洞,详细报告:https://mofeisec.com/jr?p=a347ba

Flag which would allow `s` to return URL

It would be nice if s could return URL.
Something like this could be useful:

firefox --new-tab "$(s -u -p wikipedia rhinos)"

(-u or -r or whatever you think is better)

There are other examples.
What do you think?

Best regards.

Create config file for language and locale stuff

I had this idea to have a config file for s just for the language and locale of the searches.
This way we can limit the provider list for each country.

Like the dumpert provider is probably never used for a person who isn't dutch and the arxiv provider vice versa.

For example we can just create something like a config file with the option to show only the providers for a special country like NL or RU or just simply ALL.

For example the config file can look as follow:

locale: NL
sitescountry: NL

If I want to just search in English I just change the above one or if I only want the list limit to one country I change the bottom one.

This way we can prevent that the provider list is getting way to big by adding just stuff that no one cares about in some countries and make it still clear.

Another benefit is that the autocomplete and the <tab> support will work a lot better if we have, for example, a lot of Russian sites added. It will be a lot more usefull to use and the list won't be that big this way.

What's your opinion about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.