1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Add the possibility to define rewrite rules for each feed

This commit is contained in:
Frédéric Guillot 2017-12-11 22:16:32 -08:00
parent 87ccad5c7f
commit 33445e5b68
29 changed files with 214 additions and 72 deletions

View file

@ -14,6 +14,7 @@ import (
"github.com/miniflux/miniflux2/http"
"github.com/miniflux/miniflux2/model"
"github.com/miniflux/miniflux2/reader/icon"
"github.com/miniflux/miniflux2/reader/processor"
"github.com/miniflux/miniflux2/storage"
)
@ -63,6 +64,9 @@ func (h *Handler) CreateFeed(userID, categoryID int64, url string) (*model.Feed,
return nil, err
}
feedProcessor := processor.NewFeedProcessor(subscription)
feedProcessor.Process()
subscription.Category = &model.Category{ID: categoryID}
subscription.EtagHeader = response.ETag
subscription.LastModifiedHeader = response.LastModified
@ -136,6 +140,11 @@ func (h *Handler) RefreshFeed(userID, feedID int64) error {
return err
}
feedProcessor := processor.NewFeedProcessor(subscription)
feedProcessor.WithScraperRules(originalFeed.ScraperRules)
feedProcessor.WithRewriteRules(originalFeed.RewriteRules)
feedProcessor.Process()
originalFeed.EtagHeader = response.ETag
originalFeed.LastModifiedHeader = response.LastModified