-
Notifications
You must be signed in to change notification settings - Fork 2
/
bbc.go
38 lines (29 loc) · 790 Bytes
/
bbc.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 bbcFeeds = []string{
"http://feeds.bbci.co.uk/news/rss.xml",
"http://feeds.bbci.co.uk/news/world/rss.xml",
"http://feeds.bbci.co.uk/news/politics/rss.xml",
"http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml",
}
// BBC provides support for BBC searches.
type BBC struct{}
// NewBBC returns a BBC Searcher value.
func NewBBC() Searcher {
return BBC{}
}
// Search performs a search against the CNN RSS feeds.
func (BBC) Search(uid string, term string, found chan<- []Result) {
results := []Result{}
for _, feed := range bbcFeeds {
res, err := rssSearch(uid, term, "BBC", feed)
if err != nil {
log.Println("ERROR: ", err)
continue
}
results = append(results, res...)
}
found <- results
}