Rework fixers to decide what to use and move dehtmlify process in them.

Added githubv fixer.
This commit is contained in:
2026-08-09 07:27:19 +05:00
parent f37a1422e2
commit 7b13dce342
4 changed files with 48 additions and 17 deletions
+7 -4
View File
@@ -1,17 +1,20 @@
package fixers
type fixerFunc func(title, body string) (string, string)
import "github.com/mmcdole/gofeed"
type fixerFunc func(feedItem *gofeed.Item) (string, string)
var fixers = map[string]fixerFunc{
"github.com": githubFixer,
"www.opennet.ru": opennetFixer,
}
// Fix fixes title and body depending on site parsed.
func Fix(domain, title, body string) (string, string) {
func Fix(domain string, feedItem *gofeed.Item) (string, string) {
fixer, found := fixers[domain]
if !found {
return title, body
return feedItem.Title, feedItem.Description
}
return fixer(title, body)
return fixer(feedItem)
}