Skip to content

Commit

Permalink
Add ecosia provider
Browse files Browse the repository at this point in the history
  • Loading branch information
zquestz committed Jan 5, 2022
1 parent 98ce802 commit d18b15b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ Custom providers require a few things:
* dribbble
* duckduckgo
* dumpert
* ecosia
* engadget
* explainshell
* facebook
Expand Down
25 changes: 25 additions & 0 deletions providers/ecosia/ecosia.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ecosia

import (
"fmt"
"net/url"

"github.com/zquestz/s/providers"
)

func init() {
providers.AddProvider("ecosia", &Provider{})
}

// Provider merely implements the Provider interface.
type Provider struct{}

// BuildURI generates a search URL for Ecosia.
func (p *Provider) BuildURI(q string) string {
return fmt.Sprintf("https://www.ecosia.org/search?q=%s", url.QueryEscape(q))
}

// Tags returns the tags relevant to this provider.
func (p *Provider) Tags() []string {
return []string{"search"}
}
1 change: 1 addition & 0 deletions s.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
_ "github.com/zquestz/s/providers/dribbble"
_ "github.com/zquestz/s/providers/duckduckgo"
_ "github.com/zquestz/s/providers/dumpert"
_ "github.com/zquestz/s/providers/ecosia"
_ "github.com/zquestz/s/providers/engadget"
_ "github.com/zquestz/s/providers/explainshell"
_ "github.com/zquestz/s/providers/facebook"
Expand Down

0 comments on commit d18b15b

Please sign in to comment.