1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

Refactor manual entry scraper

This commit is contained in:
Frédéric Guillot 2018-12-02 20:51:06 -08:00
parent 52de36b158
commit 311a133ab8
6 changed files with 34 additions and 19 deletions

View file

@ -6,12 +6,11 @@ package ui // import "miniflux.app/ui"
import (
"net/http"
"miniflux.app/http/request"
"miniflux.app/http/response/json"
"miniflux.app/model"
"miniflux.app/reader/rewrite"
"miniflux.app/reader/sanitizer"
"miniflux.app/reader/scraper"
"miniflux.app/reader/processor"
)
func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
@ -31,15 +30,11 @@ func (h *handler) fetchContent(w http.ResponseWriter, r *http.Request) {
return
}
content, err := scraper.Fetch(entry.URL, entry.Feed.ScraperRules, entry.Feed.UserAgent)
if err != nil {
if err := processor.ProcessEntryWebPage(entry); err != nil {
json.ServerError(w, r, err)
return
}
content = rewrite.Rewriter(entry.URL, content, entry.Feed.RewriteRules)
entry.Content = sanitizer.Sanitize(entry.URL, content)
h.store.UpdateEntryContent(entry)
json.OK(w, r, map[string]string{"content": entry.Content})