Add Irish RAIU, close #71

This commit is contained in:
Lucidiot 2021-03-19 19:18:24 +01:00
parent 24b2e6cd20
commit 0f9408a6c2
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
3 changed files with 45 additions and 1 deletions

View File

@ -1048,5 +1048,21 @@
<output>sia/sv.xml</output>
</feed>
</source>
<source id="ie-raiu">
<name>Rail Accident Investigation Unit</name>
<region>Ireland</region>
<type>Rail</type>
<frequency>0-3 reports/year</frequency>
<feed format="rss" lang="English" type="rail" id="ie-raiu-rss">
<curl>
<url>https://www.raiu.ie/site/main/inc/modc2_investigations-results.tpl?varPAGEMAX=10000</url>
</curl>
<pup>.card-body</pup>
<jq path="ie-raiu.jq" />
<json2xml />
<output>ie-raiu.xml</output>
</feed>
</source>
</section>
</itsb>

View File

@ -14,7 +14,7 @@ import "./helpers" as helpers;
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"generator": "ITSB",
"item": [.[] | {
"title": .children[0].children[0].text,
"description": .children[1].text,

28
jq/ie-raiu.jq Normal file
View File

@ -0,0 +1,28 @@
# Ireland Railway Accident Investigation Unit feed generator
# Expects pup JSON output holding div.card-body 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": "RAIU",
"description": "Irish Railway Accident Investigation Unit accident reports",
"link": "https://www.raiu.ie/investigations/",
"language": "en-IE",
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"item": [.[].children | {
"title": .[1].children[0].text,
"link": (.[1].children[0].href | sub("\\[levelPATH\\]"; "https://www.raiu.ie/investigations")),
"guid": {
"@isPermaLink": false,
"#text": .[1].children[0].href
},
"pubDate": (.[0].text | strptime("%d %B %Y") | mktime | strftime("%a, %d %b %Y %T %z"))
}]
}
}
}