33 lines
1.3 KiB
Plaintext
33 lines
1.3 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.
|
|
import "./helpers" as helpers;
|
|
|
|
{
|
|
"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://www.rssboard.org/rss-specification",
|
|
"ttl": 1440,
|
|
"generator": "ITSB",
|
|
"item": [.[] | {
|
|
"title": .children[0].children[0].text,
|
|
"description": .children[1].text,
|
|
"link": (.children[0].children[0].href|helpers::urlresolve("https://www.atsb.gov.au")),
|
|
"guid": (.children[0].children[0].href|helpers::urlresolve("https://www.atsb.gov.au")),
|
|
"pubDate": (
|
|
if .children[4].text == "N/A" then .children[2].text else .children[4].text end
|
|
| strptime("%d %b %Y")
|
|
| mktime
|
|
| strftime("%a, %d %b %Y %T %z")
|
|
)
|
|
}]
|
|
}
|
|
}
|
|
}
|