diff --git a/feedgen.sh b/feedgen.sh index 88bb292..8976e6c 100755 --- a/feedgen.sh +++ b/feedgen.sh @@ -11,4 +11,12 @@ echo Building ATSB feed to $DIR/feeds/atsb.xml curl -s 'https://www.atsb.gov.au/publications/safety-investigation-reports/?s=1&sort=OccurrenceReleaseDate&sortAscending=descending&investigationStatus=Completed,Discontinued&printAll=true' \ | pup 'table.selectable_grid tr:not(.header) json{}' \ | jq -f $DIR/jq/atsb.jq \ - | json2xml > $DIR/feeds/atsb.xml.new && mv $DIR/feeds/atsb.xml.new $DIR/feeds/atsb.xml + | json2xml > $DIR/feeds/atsb.xml.new \ + && mv $DIR/feeds/atsb.xml.new $DIR/feeds/atsb.xml + +echo Building TAIC feed to $DIR/feeds/taic.xml +curl -s 'https://www.taic.org.nz/inquiries?order=field_publication_date&sort=desc' \ + | pup '#view-table-wrapper tbody tr json{}' \ + | jq -f $DIR/jq/taic.jq \ + | json2xml > $DIR/feeds/taic.xml.new \ + && mv $DIR/feeds/taic.xml.new $DIR/feeds/taic.xml diff --git a/index.html b/index.html index 6635bff..8d6db73 100644 --- a/index.html +++ b/index.html @@ -153,6 +153,32 @@ + +

Transport Accident Investigation Commission

+ + + + + + + + + + + + + + + + + + + + + + + +
CountryNew Zealand
LanguageEnglish
TypesRail, aviation, marine
Frequency10-20 reports/year
Feedlink
diff --git a/jq/taic.jq b/jq/taic.jq new file mode 100644 index 0000000..292fb8f --- /dev/null +++ b/jq/taic.jq @@ -0,0 +1,25 @@ +# TAIC feed generator from https://www.taic.org.nz/inquiries?order=field_publication_date&sort=desc +# Expects pup JSON output holding 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")) + }] + } + } +}