Add BFU custom feeds

This commit is contained in:
Lucidiot 2020-03-24 08:34:41 +01:00
parent fa3d37a4fa
commit db3ea03b14
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
5 changed files with 93 additions and 1 deletions

View File

@ -114,3 +114,18 @@ curl -s 'https://dmaib.com/reports/?categorizations=9510' \
--arg link 'https://dmaib.com/reports/?categorizations=9510' \
| json2xml -s -ns 'http://search.yahoo.com/mrss/' media > $DIR/feeds/dmaib.xml.new \
&& mv $DIR/feeds/dmaib.xml.new $DIR/feeds/dmaib.xml
log Building BFU English feed to $DIR/feeds/bfu/en.xml
mkdir -p $DIR/feeds/bfu
curl -s 'https://www.bfu-web.de/EN/Publications/Investigation%20Report/reports_node.html?cms_gts=238148_list%253DdateOfIssue_dt%252Bdesc' \
| pup 'table.links tbody tr json{}' \
| jq -f $DIR/jq/bfu/en.jq \
| json2xml > $DIR/feeds/bfu/en.xml.new \
&& mv $DIR/feeds/bfu/en.xml.new $DIR/feeds/bfu/en.xml
log Building BFU Deutsch feed to $DIR/feeds/bfu/de.xml
curl -s 'https://www.bfu-web.de/DE/Publikationen/Untersuchungsberichte/untersuchungsberichte_node.html?cms_gts=235998_list%253DdateOfIssue_dt%252Bdesc' \
| pup 'table.links tbody tr json{}' \
| jq -f $DIR/jq/bfu/de.jq \
| json2xml > $DIR/feeds/bfu/de.xml.new \
&& mv $DIR/feeds/bfu/de.xml.new $DIR/feeds/bfu/de.xml

BIN
img/rss-deutsch.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

View File

@ -413,7 +413,7 @@
<tr>
<td><strong>Feeds</strong></td>
<td>
<a href="feeds/aibd/aviation.xml" target="_blank"><img src="img/rss-aviation.gif" alt="Aviation RSS" /></a><br />
<a href="feeds/aibd/aviation.xml" target="_blank"><img src="img/rss-aviation.gif" alt="Aviation RSS" /></a>
<a href="feeds/aibd/rail.xml" target="_blank"><img src="img/rss-rail.gif" alt="Rail RSS" /></a>
</td>
</tr>
@ -445,6 +445,35 @@
</tr>
</tbody>
</table>
<h3>Bundesstelle für Flugunfalluntersuchnung</h3>
<table>
<tbody>
<tr>
<td><strong>Country</strong></td>
<td>Germany</td>
</tr>
<tr>
<td><strong>Language</strong></td>
<td>German, English</td>
</tr>
<tr>
<td><strong>Types</strong></td>
<td>Aviation</td>
</tr>
<tr>
<td><strong>Frequency</strong></td>
<td>10 reports/year</td>
</tr>
<tr>
<td><strong>Feeds</strong></td>
<td>
<a href="feeds/bfu/de.xml" target="_blank"><img src="img/rss-deutsch.gif" /></a>
<a href="feeds/bfu/en.xml" target="_blank"><img src="img/rss-english.gif" /></a>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

24
jq/bfu/de.jq Normal file
View File

@ -0,0 +1,24 @@
# BFU English 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.
{
"rss": {
"@version": "2.0",
"channel": {
"title": "BFU Deutsch",
"description": "Bundesstelle für Flugunfalluntersuchung",
"link": "https://www.bfu-web.de/DE/Publikationen/Untersuchungsberichte/untersuchungsberichte_node.html?cms_gts=235998_list%253DdateOfIssue_dt%252Bdesc",
"language": "de-DE",
"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 + ": " + .children[2].text + ", " + .children[1].text),
"link": ("https://www.bfu-web.de" + .children[3].children[0].href),
"pubDate": (.children[0].text | strptime("%d.%m.%Y") | mktime | strftime("%a, %d %b %Y %T %z"))
}]
}
}
}

24
jq/bfu/en.jq Normal file
View File

@ -0,0 +1,24 @@
# BFU English 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.
{
"rss": {
"@version": "2.0",
"channel": {
"title": "BFU English",
"description": "Bundesstelle für Flugunfalluntersuchung",
"link": "https://www.bfu-web.de/EN/Publications/Investigation%20Report/reports_node.html?cms_gts=238148_list%253DdateOfIssue_dt%252Bdesc",
"language": "en-DE",
"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 + ": " + .children[2].text + ", " + .children[1].text),
"link": ("https://www.bfu-web.de" + .children[3].children[0].href),
"pubDate": (.children[0].text | strptime("%Y.%m.%d") | mktime | strftime("%a, %d %b %Y %T %z"))
}]
}
}
}