Resolve URLs properly in Denmark feeds

This commit is contained in:
Lucidiot 2021-05-14 08:45:42 +02:00
parent 40a858c183
commit a4eeecec21
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
1 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,7 @@
# $link: Channel link
# Expects pup JSON output holding <li> tags, outputs xmltodict-compatible JSON
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
import "./helpers" as helpers;
{
"rss": {
@ -30,8 +31,8 @@
| {
"title": .children[-1].children[0].children[0].text,
"description": .children[-1].children[-1].text,
"link": .["data-url"],
"guid": .["data-url"],
"link": (.["data-url"] | helpers::urlresolve($link)),
"guid": (.["data-url"] | helpers::urlresolve($link)),
"pubDate": (
.children[-1].children[1].text[-10:]
| strptime("%d-%m-%Y")
@ -47,7 +48,9 @@
}
# Optional MediaRSS thumbnail
| if $item.children[0].class == "media-left" then
.["http://search.yahoo.com/mrss/:thumbnail"] = {"@url": $item.children[0].children[0].src}
.["http://search.yahoo.com/mrss/:thumbnail"] = {
"@url": ($item.children[0].children[0].src | helpers::urlresolve($link))
}
else . end
]
}