aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/parse.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-20 01:01:37 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-20 01:01:37 +0200
commitf1231aa444bd13aa031fe6e3dac32138436f956b (patch)
tree9f8bcbc1ca455bd451020c1a4303e11b451dc4ea /internal/feed/parse.go
parent161dd4405474cc905e6912bab243509a3a6f88db (diff)
downloadfeed2imap-go-f1231aa444bd13aa031fe6e3dac32138436f956b.tar.gz
feed2imap-go-f1231aa444bd13aa031fe6e3dac32138436f956b.tar.bz2
feed2imap-go-f1231aa444bd13aa031fe6e3dac32138436f956b.zip
Feeditems
Diffstat (limited to '')
-rw-r--r--internal/feed/parse.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/feed/parse.go b/internal/feed/parse.go
index a38be92..00b6aff 100644
--- a/internal/feed/parse.go
+++ b/internal/feed/parse.go
@@ -19,10 +19,16 @@ func parseFeed(feed *Feed) error {
ctx, cancel := context()
defer cancel()
fp := gofeed.NewParser()
- if _, err := fp.ParseURLWithContext(feed.Url, ctx); err != nil {
+ parsedFeed, err := fp.ParseURLWithContext(feed.Url, ctx)
+ if err != nil {
return fmt.Errorf("while fetching %s from %s: %w", feed.Name, feed.Url, err)
}
+ feed.feed = parsedFeed
+ feed.items = make([]feeditem, len(parsedFeed.Items))
+ for _, item := range parsedFeed.Items {
+ feed.items = append(feed.items, feeditem{parsedFeed, item})
+ }
return nil
}