itsb/jq/zma.jq

30 lines
1.2 KiB
Plaintext

# Zanzibar Maritime Authority feed generator
# Expects pup JSON output holding <a> 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": "ZMA investigation reports",
"description": "Zanzibar Maritime Authority accident investigation reports",
"link": "https://www.zma.go.tz/ZMA_Accidents.html",
"language": "en-tz",
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"item": [.[].children | select(.[0].children[1].href != "#") | {
"title": .[1].text,
"link": (.[0].children[1].href | helpers::urlresolve("https://www.zma.go.tz/ZMA_Accidents.html")),
"description": .[2].text,
"guid": {
"@isPermaLink": "true",
"#text": (.[0].children[1].href | helpers::urlresolve("https://www.zma.go.tz/ZMA_Accidents.html"))
}
}]
}
}
}