39 lines
1.4 KiB
Plaintext
39 lines
1.4 KiB
Plaintext
# SIA feed generator
|
|
# Required arguments:
|
|
# $title: Feed title
|
|
# $language: ISO 639-1 language code (sv, fi or en)
|
|
# $description: Feed description
|
|
# $link: Feed link
|
|
# Expects xmltodict output holding the API result, outputs xmltodict-compatible JSON
|
|
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
|
import "./helpers" as helpers;
|
|
|
|
{
|
|
"rss": {
|
|
"@version": "2.0",
|
|
"channel": {
|
|
"title": $title,
|
|
"description": $description,
|
|
"link": $link,
|
|
"language": ($language + "-FI"),
|
|
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
|
"docs": "https://www.rssboard.org/rss-specification",
|
|
"ttl": 1440,
|
|
"generator": "ITSB",
|
|
"item": [
|
|
.Stato.Card.Card.Card[].Version.Language.Row
|
|
| from_entries
|
|
| {
|
|
"title": .NavigationTitle,
|
|
"link": (.public_viewurl | helpers::urlresolve($link)),
|
|
"guid": {
|
|
"@isPermaLink": "true",
|
|
"#text": (.public_viewurl | helpers::urlresolve($link))
|
|
},
|
|
"pubDate": ((.["CMS.Kirjausaika.Epoch"] // .["N_kirjausepoch"]) | tonumber / 1000 | strftime("%a, %d %b %Y %T %z"))
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|