21 lines
457 B
Go
21 lines
457 B
Go
package fixers
|
|
|
|
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 string, feedItem *gofeed.Item) (string, string) {
|
|
fixer, found := fixers[domain]
|
|
if !found {
|
|
return feedItem.Title, feedItem.Description
|
|
}
|
|
|
|
return fixer(feedItem)
|
|
}
|