itsb/jq/skybrary.jq

54 lines
2.1 KiB
Plaintext

{
"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://www.rssboard.org/rss-specification",
"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 [] end
),
"guid": {
"@isPermaLink": "true",
"#text": .fullurl
},
"category": [
([.printouts["Event Type"][].fulltext] + .printouts["GeneralSub"])
| unique[]
| {
"@domain": "https://www.skybrary.aero",
"#text": .
}
]
}
]
}
}
}