itsb/jq/atsb.jq

26 lines
1.0 KiB
Plaintext

# ATSB feed generator
# 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": "ATSB",
"description": "Australian Transport Safety Bureau accident reports",
"link": "https://www.atsb.gov.au/publications/safety-investigation-reports/",
"language": "en-au",
"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[0].text,
"description": .children[1].text,
"link": ("https://www.atsb.gov.au" + .children[0].children[0].href),
"pubDate": (try (.children[4].text | strptime("%d %b %Y") | mktime | strftime("%a, %d %b %Y %T %z")))
}]
}
}
}