diff --git a/feedgen.sh b/feedgen.sh index 01b73c8..8355195 100755 --- a/feedgen.sh +++ b/feedgen.sh @@ -116,6 +116,27 @@ curl -s 'https://www.uzpln.cz/zpravy-ln' \ | json2xml > $DIR/feeds/uzpln/cz.xml.new \ && mv $DIR/feeds/uzpln/cz.xml.new $DIR/feeds/uzpln/cz.xml +log Building TSIB Marine feed to $DIR/feeds/tsib/marine.xml +mkdir -p $DIR/feeds/tsib +curl -s 'https://www.mot.gov.sg/about-mot/transport-safety-investigation-bureau/msib/investigation-report/' \ + | pup '.container-twelve .eight > .row:last-child tbody > tr json{}' \ + | jq -L $DIR/jq \ + -f $DIR/jq/tsib.jq \ + --arg type Marine \ + --arg link 'https://www.mot.gov.sg/about-mot/transport-safety-investigation-bureau/msib/investigation-report/' \ + | json2xml > $DIR/feeds/tsib/marine.xml.new \ + && mv $DIR/feeds/tsib/marine.xml.new $DIR/feeds/tsib/marine.xml + +log Building TSIB Aviation feed to $DIR/feeds/tsib/air.xml +curl -s 'https://www.mot.gov.sg/about-mot/transport-safety-investigation-bureau/aaib/investigation-report/' \ + | pup '.container-twelve .eight > .row:last-child tbody > tr json{}' \ + | jq -L $DIR/jq \ + -f $DIR/jq/tsib.jq \ + --arg type Aviation \ + --arg link 'https://www.mot.gov.sg/about-mot/transport-safety-investigation-bureau/aaib/investigation-report/' \ + | json2xml > $DIR/feeds/tsib/air.xml.new \ + && mv $DIR/feeds/tsib/air.xml.new $DIR/feeds/tsib/air.xml + log Building JTSB Aviation English feed to $DIR/feeds/jtsb/en/air.xml mkdir -p $DIR/feeds/jtsb/en curl -s 'https://www.mlit.go.jp/jtsb/airrep.html' \ diff --git a/img/rss-marine.gif b/img/rss-marine.gif new file mode 100644 index 0000000..60ac069 Binary files /dev/null and b/img/rss-marine.gif differ diff --git a/index.html b/index.html index 1783cfb..bbc6ded 100644 --- a/index.html +++ b/index.html @@ -625,6 +625,35 @@ + +

Transport Safety Investigation Bureau

+ + + + + + + + + + + + + + + + + + + + + + + +
CountrySingapore
LanguageEnglish
TypesAviation, Marine
Frequency10 reports/year
Feeds + + +
diff --git a/jq/tsib.jq b/jq/tsib.jq new file mode 100644 index 0000000..27288bc --- /dev/null +++ b/jq/tsib.jq @@ -0,0 +1,28 @@ +# Transport Safety Investigation Bureau (Singapore) feed generator +# Required arguments: +# $type: Feed type (Aviation or Marine) +# $link: Feed link +# 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. +import "./helpers" as helpers; + +{ + "rss": { + "@version": "2.0", + "channel": { + "title": "TSIB \($type)", + "description": "Transport Safety Investigation Bureau \($type) accident reports", + "link": $link, + "language": "en-SG", + "pubDate": (now | strftime("%a, %d %b %Y %T %z")), + "docs": "https://cyber.harvard.edu/rss/rss.html", + "ttl": 86400, + "generator": "ITSB", + "item": [.[] | { + "title": ((.children[3].children[0].text | .[:index(" (PDF")]) + " - " + .children[2].text), + "link": (.children[3].children[0].href | helpers::urlresolve($link)), + "pubDate": (.children[0].text | strptime("%d %b %Y") | mktime | strftime("%a, %d %b %Y %T %z")) + }] + } + } +}