From eb431dc9bfd0c5962b1b7ee6fbd2d2c04f20dcb5 Mon Sep 17 00:00:00 2001 From: Erwan Rouchet Date: Tue, 28 Sep 2021 09:06:49 +0200 Subject: [PATCH] Rewrite DAAI feed, close #87 --- itsb.xml | 9 +++++++-- jq/daai.jq | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/itsb.xml b/itsb.xml index 35078e9..473abb5 100644 --- a/itsb.xml +++ b/itsb.xml @@ -820,9 +820,14 @@ 3-5 reports/year - https://mwt.gov.na/published-daai-report/-/document_library/PVB0Gp2amxBo/view/1344073?_com_liferay_document_library_web_portlet_DLPortlet_INSTANCE_PVB0Gp2amxBo_displayStyle=list + https://mwt.gov.na/published-daai-report - tr[data-title] + + #our-content tr:not(:first-child) daai.xml diff --git a/jq/daai.jq b/jq/daai.jq index 5466657..599d1c4 100644 --- a/jq/daai.jq +++ b/jq/daai.jq @@ -9,22 +9,28 @@ import "./helpers" as helpers; "channel": { "title": "DAAI", "description": "Namibian Directorate of Aircraft Accidents and Investigation reports", - "link": "https://mwt.gov.na/web/mwt/published-reports", + "link": "https://mwt.gov.na/published-daai-report", "language": "en-na", "pubDate": (now | strftime("%a, %d %b %Y %T %z")), "docs": "https://www.rssboard.org/rss-specification", "ttl": 1440, "generator": "ITSB", "item": [ - .[] + .[1:][].children | { - "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[0].children[0].href | sub("\\?.*$"; "")) - } + "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")), + "category": [ + [.[1].children[0].text, .[-1].children[-1].text][] + | { + "@domain": "https://mwt.gov.na", + "#text": . + } + ] + } + | .guid = { + "@isPermaLink": "true", + "#text": .link } ] }