mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
Add scraper rules
This commit is contained in:
parent
7a35c58f53
commit
87ccad5c7f
16 changed files with 140 additions and 34 deletions
|
@ -40,18 +40,14 @@ func (c *Controller) FetchContent(ctx *core.Context, request *core.Request, resp
|
|||
return
|
||||
}
|
||||
|
||||
content, err := scraper.Fetch(entry.URL)
|
||||
content, err := scraper.Fetch(entry.URL, entry.Feed.ScraperRules)
|
||||
if err != nil {
|
||||
response.JSON().ServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(content) > len(entry.Content) {
|
||||
entry.Content = content
|
||||
c.store.UpdateEntryContent(entry)
|
||||
} else {
|
||||
content = entry.Content
|
||||
}
|
||||
entry.Content = content
|
||||
c.store.UpdateEntryContent(entry)
|
||||
|
||||
response.JSON().Created(map[string]string{"content": content})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue