itsb/jq/taic.jq

27 lines
1.1 KiB
Plaintext

# TAIC feed generator from https://www.taic.org.nz/inquiries?order=field_publication_date&sort=desc
# 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": "TAIC",
"description": "Transport Accident Investigation Commission accident reports",
"link": "https://www.taic.org.nz/inquiries",
"language": "en-nz",
"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].text,
"description": .children[0].children[2].text,
"link": (.children[0].children[1].href|helpers::urlresolve("https://www.taic.org.nz")),
"pubDate": (.children[3].children[0].datetime | fromdateiso8601 | strftime("%a, %d %b %Y %T %z"))
}]
}
}
}