From 5c629fe1cd3a71b064defe72d41c0b768bc4e6a5 Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Tue, 30 Jun 2020 16:02:55 +0200 Subject: [PATCH] Don't post empty articles. --- getarticles.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/getarticles.go b/getarticles.go index ac1b0c6..1c6c85b 100644 --- a/getarticles.go +++ b/getarticles.go @@ -211,6 +211,12 @@ func getArticles(feedURL string, max int, noExcerpt bool) (string, error) { return "", err } + // If the content is empty after html2text (e.g. consisting of an image only) + // then stop processing + if strings.Replace(mastodonContent, " ", "", -1) == "" { + continue + } + output = output + mastodonContent + "\n\n" + cleanURL if i > 0 {