Parse file: feeds

This commit is contained in:
Cat /dev/Nulo 2022-12-20 15:57:28 -03:00
parent 51c8a2e1f2
commit 410c959160

View file

@ -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