]> Sergey Matveev's repositories - feeder.git/commitdiff
Take longer content between description and content
authorMatthieu Rakotojaona <m@rako.space>
Fri, 17 Feb 2023 17:13:05 +0000 (18:13 +0100)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 17 Feb 2023 18:30:04 +0000 (21:30 +0300)
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

cmd/feed2mdir/main.go

index f15826dcd4311a4f30b39fcf5d2e61263ba6d9c5..1ea7f92e70ce93d3dcc3afec6744deff21a1b898 100644 (file)
@@ -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, "<![CDATA[")
                what = strings.TrimSuffix(what, "]]>")