mirror of
https://git.keinpfusch.net/loweel/zorg
synced 2024-12-18 14:58:35 +01:00
Compare commits
No commits in common. "df43f758e9f5e64a728f360415237d77b28a6b45" and "2ea8bf202b63896950a912797206753e7e510667" have entirely different histories.
df43f758e9
...
2ea8bf202b
15
feed.go
15
feed.go
@ -7,8 +7,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"regexp"
|
||||
|
||||
strip "github.com/grokify/html-strip-tags-go"
|
||||
"github.com/mmcdole/gofeed"
|
||||
)
|
||||
|
||||
@ -51,8 +50,8 @@ func forwardLastFeed(url string) {
|
||||
|
||||
if time.Since(postAge) < Zint {
|
||||
|
||||
TheTitle := fmt.Sprintf("[News from %s ]", html2text(feed.Title))
|
||||
TheBody := fmt.Sprintf("%s\n\n %s\n\n %s\n\n%s\n ", html2text(b.Author.Name), html2text(b.Title), html2text(b.Description), b.Link)
|
||||
TheTitle := fmt.Sprintf("[News from %s ]", strip.StripTags(feed.Title))
|
||||
TheBody := fmt.Sprintf("%s \n\n%s \n\n%s", strip.StripTags(b.Author.Name), strip.StripTags(b.Description), b.Link)
|
||||
|
||||
postOnMastodon(TheBody, TheTitle)
|
||||
log.Println("New content from: ", feed.Title, b.Title, feed.Description)
|
||||
@ -109,11 +108,3 @@ func fileByLines(filename string) (blurls []string) {
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func html2text(html string) string {
|
||||
|
||||
re := regexp.MustCompile(`<[^>]*>`)
|
||||
|
||||
return re.ReplaceAllString(html, "")
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user