diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-11-29 11:17:14 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2019-11-29 11:27:58 -0800 |
commit | 69aa650203087ad6365fcd6769a49bdf327e9efb (patch) | |
tree | 2b74ede78da683a9442da0851718d981614a37b7 /reader | |
parent | 8028cc764ff7d53370b64ec8110cbcdece787432 (diff) |
Add the possibility to add rules during feed creation
Diffstat (limited to 'reader')
-rw-r--r-- | reader/feed/handler.go | 8 | ||||
-rw-r--r-- | reader/rewrite/rewriter.go | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/reader/feed/handler.go b/reader/feed/handler.go index 3da0d46..b272ea1 100644 --- a/reader/feed/handler.go +++ b/reader/feed/handler.go @@ -29,11 +29,11 @@ var ( // Handler contains all the logic to create and refresh feeds. type Handler struct { - store *storage.Storage + store *storage.Storage } // CreateFeed fetch, parse and store a new feed. -func (h *Handler) CreateFeed(userID, categoryID int64, url string, crawler bool, userAgent, username, password string) (*model.Feed, error) { +func (h *Handler) CreateFeed(userID, categoryID int64, url string, crawler bool, userAgent, username, password, scraperRules, rewriteRules string) (*model.Feed, error) { defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Handler:CreateFeed] feedUrl=%s", url)) if !h.store.CategoryExists(userID, categoryID) { @@ -59,7 +59,7 @@ func (h *Handler) CreateFeed(userID, categoryID int64, url string, crawler bool, subscription.UserID = userID subscription.WithCategoryID(categoryID) - subscription.WithBrowsingParameters(crawler, userAgent, username, password) + subscription.WithBrowsingParameters(crawler, userAgent, username, password, scraperRules, rewriteRules) subscription.WithClientResponse(response) subscription.CheckedNow() @@ -160,4 +160,4 @@ func checkFeedIcon(store *storage.Storage, feedID int64, websiteURL string) { } } } -}
\ No newline at end of file +} diff --git a/reader/rewrite/rewriter.go b/reader/rewrite/rewriter.go index c6b796a..f894ce8 100644 --- a/reader/rewrite/rewriter.go +++ b/reader/rewrite/rewriter.go @@ -37,7 +37,7 @@ func Rewriter(entryURL, entryContent, customRewriteRules string) string { entryContent = addPDFLink(entryURL, entryContent) case "nl2br": entryContent = replaceLineFeeds(entryContent) - case "convert_text_link": + case "convert_text_link", "convert_text_links": entryContent = replaceTextLinks(entryContent) } } |