apply custom timeFormat to atom feeds
All checks were successful
/ build (push) Successful in 1m51s

This commit is contained in:
mr-boneman 2025-03-27 12:40:24 +01:00
parent 4bcc3755d7
commit c5c8bd823e

View file

@ -50,6 +50,20 @@ proc mixRssFeeds*(
case feed.kind
of Atom:
entries.add parseAtom(fetched)
entries[^1].items = entries[^1].items.mapIt(
block:
var item = it
if feed.timeFormat.len != 0 and item.pubDate.isSome():
# if the IDE screams at you here, ignore it
item.pubdate =
some(parse(item.pubDate.get(), feed.timeFormat).format(atomTimeFormat))
if item.updated.isSome():
item.updated =
some(parse(item.updated.get(), feed.timeFormat).format(atomTimeFormat))
item
)
of RSSv2:
entries.add parseRss(fetched)