Add OEAIF feeds, close #41
This commit is contained in:
parent
0f9408a6c2
commit
0685bdac52
63
itsb.xml
63
itsb.xml
|
@ -1064,5 +1064,68 @@
|
|||
<output>ie-raiu.xml</output>
|
||||
</feed>
|
||||
</source>
|
||||
|
||||
<source id="oeaif">
|
||||
<name>Organisme d'Enquête sur les Accidents et Incidents Ferroviaires</name>
|
||||
<region>Belgium</region>
|
||||
<type>Rail</type>
|
||||
<frequency>3 reports/year</frequency>
|
||||
<feed type="rail" lang="French" format="rss" id="oeaif-fr">
|
||||
<curl>
|
||||
<url>https://www.rail-investigation.be/wp-admin/admin-ajax.php</url>
|
||||
<requestBody>action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125</requestBody>
|
||||
<header name="Cookie">wp-wpml_current_language=fr</header>
|
||||
</curl>
|
||||
<pup>tr</pup>
|
||||
<jq path="oeaif.jq">
|
||||
<arg name="title">OEAIF</arg>
|
||||
<arg name="lang">fr</arg>
|
||||
</jq>
|
||||
<json2xml />
|
||||
<output>oeaif/fr.xml</output>
|
||||
</feed>
|
||||
<feed type="rail" lang="Dutch" format="rss" id="oeaif-nl">
|
||||
<curl>
|
||||
<url>https://www.rail-investigation.be/wp-admin/admin-ajax.php</url>
|
||||
<requestBody>action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125</requestBody>
|
||||
<header name="Cookie">wp-wpml_current_language=nl</header>
|
||||
</curl>
|
||||
<pup>tr</pup>
|
||||
<jq path="oeaif.jq">
|
||||
<arg name="title">OOIS</arg>
|
||||
<arg name="lang">nl</arg>
|
||||
</jq>
|
||||
<json2xml />
|
||||
<output>oeaif/nl.xml</output>
|
||||
</feed>
|
||||
<feed type="rail" lang="English" format="rss" id="oeaif-en">
|
||||
<curl>
|
||||
<url>https://www.rail-investigation.be/wp-admin/admin-ajax.php</url>
|
||||
<requestBody>action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125</requestBody>
|
||||
<header name="Cookie">wp-wpml_current_language=en</header>
|
||||
</curl>
|
||||
<pup>tr</pup>
|
||||
<jq path="oeaif.jq">
|
||||
<arg name="title">RAIIU</arg>
|
||||
<arg name="lang">en</arg>
|
||||
</jq>
|
||||
<json2xml />
|
||||
<output>oeaif/en.xml</output>
|
||||
</feed>
|
||||
<feed type="rail" lang="German" format="rss" id="oeaif-de">
|
||||
<curl>
|
||||
<url>https://www.rail-investigation.be/wp-admin/admin-ajax.php</url>
|
||||
<requestBody>action=filtreEnquete&data[0][name]=enquete_etat&data[0][value]=125</requestBody>
|
||||
<header name="Cookie">wp-wpml_current_language=de</header>
|
||||
</curl>
|
||||
<pup>tr</pup>
|
||||
<jq path="oeaif.jq">
|
||||
<arg name="title">UfE</arg>
|
||||
<arg name="lang">de</arg>
|
||||
</jq>
|
||||
<json2xml />
|
||||
<output>oeaif/de.xml</output>
|
||||
</feed>
|
||||
</source>
|
||||
</section>
|
||||
</itsb>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# OEAIF 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.
|
||||
# Expected variables:
|
||||
# $title: Title of the feed
|
||||
# $lang: Language code, without the country code (fr/en/nl/de)
|
||||
|
||||
{
|
||||
"rss": {
|
||||
"@version": "2.0",
|
||||
"channel": {
|
||||
"title": $title,
|
||||
"description": $title,
|
||||
"link": "https://www.rail-investigation.be/\($lang)/",
|
||||
"language": "\($lang)-BE",
|
||||
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
||||
"docs": "https://www.rssboard.org/rss-specification",
|
||||
"ttl": 1440,
|
||||
"generator": "ITSB",
|
||||
"item": [.[] | {
|
||||
"title": .children[2].text,
|
||||
"description": (
|
||||
[
|
||||
([.children[1]] + .children[3:])[]
|
||||
| (.["data-title"] + ": " + .text)
|
||||
]
|
||||
| join("</li><li>")
|
||||
| "<ul><li>\(.)</li></ul>"
|
||||
),
|
||||
"link": .["data-href"],
|
||||
"guid": .["data-href"],
|
||||
"pubDate": (
|
||||
.children[0].text
|
||||
| strptime("%d/%m/%Y")
|
||||
| mktime
|
||||
| strftime("%a, %d %b %Y %T %z")
|
||||
)
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue