Fix DAAI feed

This commit is contained in:
~lucidiot 2024-02-20 22:33:05 +00:00
parent cded417589
commit f447ee9fc1
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
2 changed files with 6 additions and 9 deletions

View File

@ -908,18 +908,13 @@
<region>Namibia</region>
<type>Aviation</type>
<frequency>3-5 reports/year</frequency>
<url>https://mwt.gov.na/directorate-of-aircraft-accident-and-incident-investigations</url>
<url>https://mwt.gov.na/web/mwt/aviation</url>
<feed format="rss" lang="English" id="daai-rss">
<curl>
<!-- The SSL verification fails on tilde.town for some reason, but it works properly in web browsers. -->
<url verify-ssl="false">https://mwt.gov.na/published-daai-report</url>
<url verify-ssl="false">https://mwt.gov.na/web/mwt/completed-investigations</url>
</curl>
<!--
We would need both :not(:first-child) and :not(:nth-child(2)) to
properly remove all the header rows since there are two of them,
but pup does not allow that so the jq script will ignore the first row it gets.
-->
<pup>#our-content tr:not(:first-child)</pup>
<pup>.journal-content-article tr</pup>
<jq path="daai.jq" />
<json2xml />
<output>daai.xml</output>

View File

@ -16,7 +16,9 @@ import "./helpers" as helpers;
"ttl": 1440,
"generator": "ITSB",
"item": [
.[1:][].children
.[].children
# Only include rows that contain hyperlinks, to skip blank rows or headers
| select(try .[].children[].tag == "a")
| {
"title": "\(.[1].children[0].text) - \(.[2].children[0].text) \(.[3].children[0].children[0].text) - \(.[-1].children[-1].text)",
"link": (.[3].children[0].children[0].href | helpers::urlresolve("https://mwt.gov.na/published-daai-report")),