35 lines
1.4 KiB
Plaintext
35 lines
1.4 KiB
Plaintext
# JTSB marine feed generator (English version) from http://www.mlit.go.jp/jtsb/marrep.html
|
|
# 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": "JTSB Marine",
|
|
"description": "Japan Transport Safety Board marine accident reports",
|
|
"link": "http://www.mlit.go.jp/jtsb/marrep.html",
|
|
"language": "en",
|
|
"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
|
|
+ " - "
|
|
+ .children[4].children[0].text
|
|
),
|
|
"description": (
|
|
.children[3].children[0].text
|
|
+ " - "
|
|
+ .children[5].children[0].text
|
|
),
|
|
"link": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
|
|
"pubDate": (try (.children[1].children[0].text | strptime("%Y.%m.%d") | mktime | strftime("%a, %d %b %Y %T %z")))
|
|
}]
|
|
}
|
|
}
|
|
}
|