Fix SKYbrary feed, close #114

This commit is contained in:
~lucidiot 2022-08-29 06:27:23 +02:00
parent f9a5551f53
commit d2eafe984e
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
2 changed files with 4 additions and 3 deletions

View File

@ -838,9 +838,10 @@
<feed format="rss" lang="English" id="skybrary-rss">
<curl>
<url>https://skybrary.aero/accidents-map</url>
<header name="User-Agent">Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36</header>
</curl>
<!-- Retrieve the GeoJSON features from within a <script> tag -->
<shell><![CDATA[grep -o '"features":\[.*}\]}\]' | tail -c+12 | head -c-3]]></shell>
<shell><![CDATA[grep -o '"features":\[.*}\]' | tail -c+12 | head -c-1]]></shell>
<jq path="skybrary.jq" />
<json2xml>
<namespace prefix="georss">http://www.georss.org/georss</namespace>

View File

@ -22,11 +22,11 @@ import "./helpers" as helpers;
"item": [
.[]
# Parse the HTML popup content to extract the link and description
| .popup |= capture("^<a href=\"(?<link>[^\"]*)\">.*</a>(?<description>.*)$"; "m")
| .popup |= capture("^<a href=\"(?<link>[^\"]*)\"[^>]*>.*</a>(?<description>.*)$"; "m")
# Make the URL absolute
| .popup.link |= helpers::urlresolve("https://skybrary.aero/accidents-map")
| {
"title": .label,
"title": (.label | gsub("<[^>]*>"; "")),
"link": .popup.link,
"description": .popup.description,
"guid": {