itsb/jq/uzpln.jq

34 lines
1.3 KiB
Plaintext

# ÚZPLN feed generator
# Required arguments:
# $language: Feed language
# $description: Feed description
# $link: Feed link
# Expects pup JSON output holding <tr> 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": {
"@version": "2.0",
"channel": {
"title": ("ÚZPLN (" + $language + ")"),
"description": $description,
"link": $link,
"language": $language,
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"item": [.[] | {
"title": ("\(.children[3].text) - \(.children[4].text) - \(.children[6].text)" + (if .children[2].text then " (\(.children[2].text))" else "" end)),
"link": (.children[-1].children[0].href | helpers::urlresolve($link)),
"pubDate": (.children[1].text | strptime("%Y-%m-%d") | mktime | strftime("%a, %d %b %Y %T %z")),
"category": [
{"@domain": $link, "#text": .children[0].text},
{"@domain": $link, "#text": .children[5].text}
]
}]
}
}
}