itsb/jq/taic.jq

26 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.
{
"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://cyber.harvard.edu/rss/rss.html",
"ttl": 86400,
"generator": "ITSB",
"item": [.[] | {
"title": .children[0].children[1].text,
"description": .children[0].children[2].text,
"link": ("https://www.taic.org.nz" + .children[0].children[1].href),
"pubDate": (.children[3].children[0].datetime | fromdateiso8601 | strftime("%a, %d %b %Y %T %z"))
}]
}
}
}