2026-08-05 12:06:46 +05:00
|
|
|
package fixers
|
|
|
|
|
|
2026-08-09 07:27:19 +05:00
|
|
|
import "github.com/mmcdole/gofeed"
|
|
|
|
|
|
|
|
|
|
type fixerFunc func(feedItem *gofeed.Item) (string, string)
|
2026-08-05 12:06:46 +05:00
|
|
|
|
|
|
|
|
var fixers = map[string]fixerFunc{
|
2026-08-09 07:27:19 +05:00
|
|
|
"github.com": githubFixer,
|
2026-08-05 12:06:46 +05:00
|
|
|
"www.opennet.ru": opennetFixer,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fix fixes title and body depending on site parsed.
|
2026-08-09 07:27:19 +05:00
|
|
|
func Fix(domain string, feedItem *gofeed.Item) (string, string) {
|
2026-08-05 12:06:46 +05:00
|
|
|
fixer, found := fixers[domain]
|
|
|
|
|
if !found {
|
2026-08-09 07:27:19 +05:00
|
|
|
return feedItem.Title, feedItem.Description
|
2026-08-05 12:06:46 +05:00
|
|
|
}
|
|
|
|
|
|
2026-08-09 07:27:19 +05:00
|
|
|
return fixer(feedItem)
|
2026-08-05 12:06:46 +05:00
|
|
|
}
|