From 42d156fec0f293057f05a1869096d15a1b4abc89 Mon Sep 17 00:00:00 2001 From: Lucidiot Date: Fri, 14 May 2021 08:46:47 +0200 Subject: [PATCH] Update DAAI feed --- itsb.xml | 5 ++--- jq/daai.jq | 39 +++++++-------------------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/itsb.xml b/itsb.xml index a9fae42..5ced6b8 100644 --- a/itsb.xml +++ b/itsb.xml @@ -820,10 +820,9 @@ 3-5 reports/year - https://mwt.gov.na/web/mwt/published-reports -
Mozilla/1.0
+ https://mwt.gov.na/published-daai-report/-/document_library/PVB0Gp2amxBo/view/1344073?_com_liferay_document_library_web_portlet_DLPortlet_INSTANCE_PVB0Gp2amxBo_displayStyle=list
- table + tr[data-title] daai.xml diff --git a/jq/daai.jq b/jq/daai.jq index ad9aea9..5466657 100644 --- a/jq/daai.jq +++ b/jq/daai.jq @@ -1,5 +1,5 @@ # DAAI feed generator -# Expects pup JSON output holding tags, outputs xmltodict-compatible JSON +# Expects pup JSON output holding tags, outputs xmltodict-compatible JSON # WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale. import "./helpers" as helpers; @@ -16,40 +16,15 @@ import "./helpers" as helpers; "ttl": 1440, "generator": "ITSB", "item": [ - # Ignore table headers - .[].children[].children[2:][] - # Ignore empty lines - | select(.children[3].children) + .[] | { - "title": ( - # Accident/Incident - (.children[1] | [..|.text?|strings][0]) - + " - " - # Aircraft type - + (.children[2] | [..|.text?|strings][0]) - + " " - # Aircraft registration - + (.children[3] | [..|.text?|strings][0]) - + " - " - # Report type (final/preliminary) - + (.children[4] | [..|.text?|strings][0]) - ), - "link": (.children[3].children[0].href | helpers::urlresolve("https://mwt.gov.na/web/mwt/published-reports")), - "pubDate": ((.children[0] | [..|.text?|strings][0]) | gsub("\\s+"; " ") | strptime("%d %B %Y") | mktime | strftime("%a, %d %b %Y %T %z")), + "title": .["data-title"], + "link": (.children[0].children[0].href | sub("\\?.*$"; "")), + "pubDate": (.children[3].children[0].onmouseover | match("'(.*)'").captures[0].string | strptime("%e/%m/%y %I:%M %p") | mktime | strftime("%a, %d %b %Y %T %z")), "guid": { "@isPermaLink": "true", - "#text": (.children[3].children[0].href | helpers::urlresolve("https://mwt.gov.na/web/mwt/published-reports")) - }, - "category": [ - { - "@domain": "https://mwt.gov.na", - "#text": (.children[1] | [..|.text?|strings][0]) - }, - { - "@domain": "https://mwt.gov.na", - "#text": (.children[4] | [..|.text?|strings][0]) - } - ] + "#text": (.children[0].children[0].href | sub("\\?.*$"; "")) + } } ] }