itsb/jq/bea.jq

37 lines
1.6 KiB
Plaintext

# BEA feed generator
# Expects pup JSON output holding <div class="search-entry__event"> 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": "BEA",
"description": "Rapports d'enquête publiés par le Bureau d'Enquêtes et Analyses",
"link": "https://bea.aero",
"language": "fr-FR",
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"item": [.[] | {
"title": (.children[0].children[-1].children[0].title | gsub("&#39;"; "'")),
"description": (
"<p>" + .children[0].children[-1].children[1].text + "</p>" + (
[
.children[1].children[].children
| "<dt>\(.[0].text)</dt><dd>\(.[1].children[0].text)</dd>"
]
| join("")
| if length then "<dl>\(.)</dl>" else "" end
| gsub("&#39;"; "'")
)
),
"link": (.children[0].children[-1].children[0].href | helpers::urlresolve("https://bea.aero/")),
"guid": (.children[0].children[-1].children[0].href | helpers::urlresolve("https://bea.aero/"))
}]
}
}
}