Rework fixers to decide what to use and move dehtmlify process in them.
Added githubv fixer.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package fixers
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/mmcdole/gofeed"
|
||||
"github.com/prodigeris/html2text"
|
||||
)
|
||||
|
||||
func githubFixer(item *gofeed.Item) (string, string) {
|
||||
plainTextBody, err := html2text.FromString(item.Content, html2text.Options{
|
||||
PrettyTables: true,
|
||||
})
|
||||
if err != nil {
|
||||
slog.Error("Failed to de-HTMLify github body!", "error", err.Error())
|
||||
|
||||
return item.Title, item.Content
|
||||
}
|
||||
|
||||
return item.Title, plainTextBody
|
||||
}
|
||||
Reference in New Issue
Block a user