-
Notifications
You must be signed in to change notification settings - Fork 2
/
nyt.go
38 lines (29 loc) · 829 Bytes
/
nyt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2014 Ardan Studios
//
package search
import "log"
var nytFeeds = []string{
"http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
"http://rss.nytimes.com/services/xml/rss/nyt/US.xml",
"http://rss.nytimes.com/services/xml/rss/nyt/Politics.xml",
"http://rss.nytimes.com/services/xml/rss/nyt/Business.xml",
}
// NYT provides support for NYT searches.
type NYT struct{}
// NewNYT returns a NYT Searcher value.
func NewNYT() Searcher {
return NYT{}
}
// Search performs a search against the NYT RSS feeds.
func (NYT) Search(uid string, term string, found chan<- []Result) {
results := []Result{}
for _, feed := range nytFeeds {
res, err := rssSearch(uid, term, "NYT", feed)
if err != nil {
log.Println("ERROR: ", err)
continue
}
results = append(results, res...)
}
found <- results
}