Parse file: feeds
This commit is contained in:
parent
51c8a2e1f2
commit
410c959160
1 changed files with 11 additions and 1 deletions
12
openring.go
12
openring.go
|
@ -114,7 +114,17 @@ func main() {
|
||||||
log.Println("Fetching feeds...")
|
log.Println("Fetching feeds...")
|
||||||
var feeds []*rss.Feed
|
var feeds []*rss.Feed
|
||||||
for _, source := range sources {
|
for _, source := range sources {
|
||||||
feed, err := rss.Fetch(source.String())
|
var feed *rss.Feed
|
||||||
|
var err error
|
||||||
|
if source.Scheme == "file" {
|
||||||
|
var bytes []byte
|
||||||
|
bytes, err = ioutil.ReadFile(source.Opaque)
|
||||||
|
if err == nil {
|
||||||
|
feed, err = rss.Parse(bytes)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
feed, err = rss.Fetch(source.String())
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error fetching %s: %s", source.String(), err.Error())
|
log.Printf("Error fetching %s: %s", source.String(), err.Error())
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue