itsb/jq/bfu.jq

40 lines
1.4 KiB
Plaintext

# BfU feed generator
# Required arguments:
# $title: Channel title
# $language: Channel language
# $link: Channel link
# Expects pup JSON output holding <div class="columns"> 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": $title,
"description": "Bundesstelle für Flugunfalluntersuchung",
"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": [.[].children | {
"title": .[0].children[0].children[0].text,
"link": (
.[0].children[0].href
| helpers::urlparse
# Remove jsessionid path parameter
| .params = null
| helpers::urlresolve("https://www.bfu-web.de")
),
"category": {
"@domain": "https://www.bfu-web.de",
"#text": .[0].children[0].children[1].children[0].text
},
"description": ([.[1:][].children[].text | "<p>\(.)</p>"] | join("\n"))
}]
}
}
}