42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
#!/usr/bin/jq
|
|
# SKYbrary.aero RSS feed generator
|
|
# Expects JSON from the "features" property on the Accidents and Incidents map page,
|
|
# returns an RSS feed with GeoRSS support.
|
|
import "./helpers" as helpers;
|
|
|
|
{
|
|
"rss": {
|
|
"@version": "2.0",
|
|
"@xmlns": {
|
|
"georss": "http://www.georss.org/georss"
|
|
},
|
|
"channel": {
|
|
"title": "SKYbrary Accidents and Incidents",
|
|
"description": "Latest accidents and incidents recorded by the SKYbrary project.",
|
|
"link": "https://skybrary.aero/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": [
|
|
.[]
|
|
# Parse the HTML popup content to extract the link and description
|
|
| .popup |= capture("^<a href=\"(?<link>[^\"]*)\"[^>]*>.*</a>(?<description>.*)$"; "m")
|
|
# Make the URL absolute
|
|
| .popup.link |= helpers::urlresolve("https://skybrary.aero/accidents-map")
|
|
| {
|
|
"title": (.label | gsub("<[^>]*>"; "")),
|
|
"link": .popup.link,
|
|
"description": .popup.description,
|
|
"guid": {
|
|
"@isPermaLink": "true",
|
|
"#text": .popup.link
|
|
},
|
|
"http://www.georss.org/georss:point": "\(.lat) \(.lon)"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|