From 577d47665d9ba1d4ae6e3247a4fd370863007f47 Mon Sep 17 00:00:00 2001 From: Matthieu Rakotojaona Date: Fri, 17 Feb 2023 18:13:06 +0100 Subject: [PATCH] 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 --- cmd/feed2mdir/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) 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() -- 2.48.1