From: Matthieu Rakotojaona Date: Fri, 17 Feb 2023 17:13:06 +0000 (+0100) Subject: Use media:group/media:description if it exists X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=577d47665d9ba1d4ae6e3247a4fd370863007f47;p=feeder.git Use media:group/media:description if it exists Some feeds (typically rss feeds from invidious channels) have the following structure for entries: [...] A one line title [...] An actual text that serves as a description If it's there, and again longer than the other fields, use it --- diff --git a/cmd/feed2mdir/main.go b/cmd/feed2mdir/main.go index 1ea7f92..3089a23 100644 --- a/cmd/feed2mdir/main.go +++ b/cmd/feed2mdir/main.go @@ -90,6 +90,17 @@ func main() { } else { what = item.Description } + if media, ok := item.Extensions["media"]; ok { + if mediagroups, ok := media["group"]; ok { + if len(mediagroups) == 1 { + if mediadescription, ok := mediagroups[0].Children["description"]; ok { + if len(mediadescription[0].Value) > len(what) { + what = mediadescription[0].Value + } + } + } + } + } what = strings.TrimPrefix(what, "") h.Reset()