aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/feed.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/feed/feed.go')
-rw-r--r--internal/feed/feed.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go
index 4e84443..de28ef8 100644
--- a/internal/feed/feed.go
+++ b/internal/feed/feed.go
@@ -1,6 +1,7 @@
package feed
import (
+ "fmt"
"strings"
"time"
@@ -58,3 +59,14 @@ func (feed *Feed) MarkSuccess() {
feed.cached.Commit()
}
}
+
+func Create(parsedFeed *config.Feed, global config.GlobalOptions) (*Feed, error) {
+ var itemFilter *filter.Filter
+ var err error
+ if parsedFeed.ItemFilter != "" {
+ if itemFilter, err = filter.New(parsedFeed.ItemFilter); err != nil {
+ return nil, fmt.Errorf("Feed %s: Parsing item-filter: %w", parsedFeed.Name, err)
+ }
+ }
+ return &Feed{Feed: parsedFeed, Global: global, filter: itemFilter}, nil
+}