From: Matthieu Rakotojaona Date: Fri, 17 Feb 2023 17:13:05 +0000 (+0100) Subject: Take longer content between description and content X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;ds=sidebyside;h=28a5d8bcfec37ccdfea3ec910e7a5268fc2f7b51;p=feeder.git Take longer content between description and content Sometimes the content and the description are both filled, but with garbage data. Take the one that is longest because it "feels" like a better content --- diff --git a/cmd/feed2mdir/main.go b/cmd/feed2mdir/main.go index f15826d..1ea7f92 100644 --- a/cmd/feed2mdir/main.go +++ b/cmd/feed2mdir/main.go @@ -85,10 +85,10 @@ func main() { latest = when } var what string - if len(item.Content) == 0 { - what = item.Description - } else { + if len(item.Content) > len(item.Description) { what = item.Content + } else { + what = item.Description } what = strings.TrimPrefix(what, "")