From 69aa650203087ad6365fcd6769a49bdf327e9efb Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 29 Nov 2019 11:17:14 -0800 Subject: Add the possibility to add rules during feed creation --- reader/feed/handler.go | 8 ++++---- reader/rewrite/rewriter.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'reader') 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) } } -- cgit v1.2.3