diff --git a/README.md b/README.md index ab64054..7534133 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,7 @@ Custom providers require a few things: * nhaccuatui * npm * npmsearch +* npr * nvd * overstock * packagist diff --git a/providers/npr/npr.go b/providers/npr/npr.go new file mode 100644 index 0000000..be63076 --- /dev/null +++ b/providers/npr/npr.go @@ -0,0 +1,20 @@ +package npr + +import ( + "fmt" + "net/url" + + "github.com/zquestz/s/providers" +) + +func init() { + providers.AddProvider("npr", &Provider{}) +} + +// Provider merely implements the Provider interface. +type Provider struct{} + +// BuildURI generates a search URL for NPR. +func (p *Provider) BuildURI(q string) string { + return fmt.Sprintf("http://www.npr.org/templates/search/index.php?searchinput=%s", url.QueryEscape(q)) +} diff --git a/s.go b/s.go index f2bcac8..6a676af 100644 --- a/s.go +++ b/s.go @@ -63,6 +63,7 @@ import ( _ "github.com/zquestz/s/providers/nhaccuatui" _ "github.com/zquestz/s/providers/npm" _ "github.com/zquestz/s/providers/npmsearch" + _ "github.com/zquestz/s/providers/npr" _ "github.com/zquestz/s/providers/nvd" _ "github.com/zquestz/s/providers/overstock" _ "github.com/zquestz/s/providers/packagist"