Removed filtering @-replies (the RSS feed doesn't contain them) and parse feeds description again instead of content (RSS vs. Atom).

This commit is contained in:
Martin Dosch 2018-12-18 11:08:21 +01:00
parent 330d94cfd7
commit 50cf546d6c

View file

@ -194,22 +194,20 @@ func getArticles(feedURL string, max int, noExcerpt bool) (string, error) {
// Remove redirects and tracking parameters from URL. // Remove redirects and tracking parameters from URL.
cleanURL, _ := removeTracking(article.Link) cleanURL, _ := removeTracking(article.Link)
// Don't process mastodon messages that are a reply // Don't process mastodon messages that are a reply
if strings.Contains(article.Content, "http://activitystrea.ms/schema/1.0/comment") == false { // Strip HTML as we want to get plain text.
// Strip HTML as we want to get plain text. mastodonContent := strings.Replace(article.Description, `</span><span class="ellipsis">`, "", -1)
mastodonContent := strings.Replace(article.Content, `</span><span class="ellipsis">`, "", -1) mastodonContent = strings.Replace(mastodonContent, `</span><span class="invisible">`, "", -1)
mastodonContent = strings.Replace(mastodonContent, `</span><span class="invisible">`, "", -1) mastodonContent = strings.Replace(mastodonContent, `</span>`, "", -1)
mastodonContent = strings.Replace(mastodonContent, `</span>`, "", -1) mastodonContent = strings.Replace(mastodonContent, `<span>`, "", -1)
mastodonContent = strings.Replace(mastodonContent, `<span>`, "", -1) mastodonContent, err = html2text.FromString(mastodonContent, html2text.Options{OmitLinks: true})
mastodonContent, err = html2text.FromString(mastodonContent, html2text.Options{OmitLinks: true}) if err != nil {
if err != nil { return "", err
return "", err }
}
output = output + "Kuketz-Blog: " + mastodonContent + "\n\n" + cleanURL output = output + "Kuketz-Blog: " + mastodonContent + "\n\n" + cleanURL
if i > 0 { if i > 0 {
output = output + "\n\n---\n\n" output = output + "\n\n---\n\n"
}
} }
} }