Add SKYbrary feed, close #34

This commit is contained in:
Lucidiot 2020-08-09 01:11:11 +02:00
parent da55a4bcd8
commit 517817a2d6
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
3 changed files with 84 additions and 0 deletions

View File

@ -57,6 +57,12 @@ curl -s '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 SKYbrary feed to $DIR/feeds/skybrary.xml
curl -s 'https://www.skybrary.aero/api.php?action=askargs&conditions=Category:Accidents_and_Incidents&printouts=Date%20of%20Occurence|GeneralSub|Event%20Type|Aircraft&parameters=|sort%3DDate%20of%20Occurence|order%3Ddesc|limit%3D10000&format=json&api_version=3' \
| jq -f $DIR/jq/skybrary.jq \
| json2xml > $DIR/feeds/skybrary.xml.new \
&& mv $DIR/feeds/skybrary.xml.new $DIR/feeds/skybrary.xml
log Building AIBD Aviation feed to $DIR/feeds/aibd/aviation.xml
mkdir -p $DIR/feeds/aibd
curl -s 'https://en.havarikommissionen.dk/aviation-archive/' \

View File

@ -782,6 +782,31 @@
</tr>
</tbody>
</table>
<h3>SKYbrary</h3>
<p>SKYbrary is a project from <a href="https://www.eurocontrol.int/" target="_blank">Eurocontrol</a> that aims to regroup a lot of aviation safety data, including accident reports. Although it is not an investigation agency by itself, it is included due to it providing well-written summaries of accident reports in English as well as <a href="https://www.skybrary.aero/api.php" target="_blank">an API</a>.</p>
<table>
<tbody>
<tr>
<td><strong>Language</strong></td>
<td>English</td>
</tr>
<tr>
<td><strong>Type</strong></td>
<td>Aviation</td>
</tr>
<tr>
<td><strong>Frequency</strong></td>
<td>50 reports/year</td>
</tr>
<tr>
<td><strong>Feed</strong></td>
<td>
<a href="feeds/skybrary.xml" target="_blank"><img src="img/rss.gif" alt="RSS" /></a>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

53
jq/skybrary.jq Normal file
View File

@ -0,0 +1,53 @@
{
"rss": {
"@version": "2.0",
"channel": {
"title": "SKYbrary Accidents and Incidents",
"description": "Latest accidents and incidents recorded by the SKYbrary project.",
"link": "https://www.skybrary.aero/index.php/Category:Accidents_and_Incidents",
"language": "en",
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
"docs": "https://cyber.harvard.edu/rss/rss.html",
"ttl": 1440,
"generator": "ITSB",
"item": [
.query.results[]
| values[]
| {
"title": .fulltext,
"link": .fullurl,
"description": (
[
{
"Tags": .printouts["GeneralSub"]|join(", "),
"Aircraft": [.printouts["Aircraft"][].display_title]|join(", "),
"Event Types": [.printouts["Event Type"][].fulltext]|join(", ")
}
| to_entries[]
| "\(.key): \(.value)"
] | join("\n")
),
"pubDate": (
if .printouts["Date of Occurence"]|length then
.printouts["Date of Occurence"][0].timestamp
| tonumber
| strftime("%a, %d %b %Y %T %z")
else empty end
),
"guid": {
"@isPermaLink": "true",
"#text": .fullurl
},
"category": [
([.printouts["Event Type"][].fulltext] + .printouts["GeneralSub"])
| unique[]
| {
"@domain": "https://www.skybrary.aero",
"#text": .
}
]
}
]
}
}
}