Update DAAI feed
This commit is contained in:
parent
8f5c337074
commit
42d156fec0
5
itsb.xml
5
itsb.xml
|
@ -820,10 +820,9 @@
|
||||||
<frequency>3-5 reports/year</frequency>
|
<frequency>3-5 reports/year</frequency>
|
||||||
<feed format="rss" lang="English" id="daai-rss">
|
<feed format="rss" lang="English" id="daai-rss">
|
||||||
<curl>
|
<curl>
|
||||||
<url verify-ssl="false">https://mwt.gov.na/web/mwt/published-reports</url>
|
<url verify-ssl="false">https://mwt.gov.na/published-daai-report/-/document_library/PVB0Gp2amxBo/view/1344073?_com_liferay_document_library_web_portlet_DLPortlet_INSTANCE_PVB0Gp2amxBo_displayStyle=list</url>
|
||||||
<header name="User-Agent">Mozilla/1.0</header>
|
|
||||||
</curl>
|
</curl>
|
||||||
<pup>table</pup>
|
<pup>tr[data-title]</pup>
|
||||||
<jq path="daai.jq" />
|
<jq path="daai.jq" />
|
||||||
<json2xml />
|
<json2xml />
|
||||||
<output>daai.xml</output>
|
<output>daai.xml</output>
|
||||||
|
|
39
jq/daai.jq
39
jq/daai.jq
|
@ -1,5 +1,5 @@
|
||||||
# DAAI feed generator
|
# DAAI feed generator
|
||||||
# Expects pup JSON output holding <table> tags, outputs xmltodict-compatible JSON
|
# Expects pup JSON output holding <tr> tags, outputs xmltodict-compatible JSON
|
||||||
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
||||||
import "./helpers" as helpers;
|
import "./helpers" as helpers;
|
||||||
|
|
||||||
|
@ -16,40 +16,15 @@ import "./helpers" as helpers;
|
||||||
"ttl": 1440,
|
"ttl": 1440,
|
||||||
"generator": "ITSB",
|
"generator": "ITSB",
|
||||||
"item": [
|
"item": [
|
||||||
# Ignore table headers
|
.[]
|
||||||
.[].children[].children[2:][]
|
|
||||||
# Ignore empty lines
|
|
||||||
| select(.children[3].children)
|
|
||||||
| {
|
| {
|
||||||
"title": (
|
"title": .["data-title"],
|
||||||
# Accident/Incident
|
"link": (.children[0].children[0].href | sub("\\?.*$"; "")),
|
||||||
(.children[1] | [..|.text?|strings][0])
|
"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")),
|
||||||
+ " - "
|
|
||||||
# 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")),
|
|
||||||
"guid": {
|
"guid": {
|
||||||
"@isPermaLink": "true",
|
"@isPermaLink": "true",
|
||||||
"#text": (.children[3].children[0].href | helpers::urlresolve("https://mwt.gov.na/web/mwt/published-reports"))
|
"#text": (.children[0].children[0].href | sub("\\?.*$"; ""))
|
||||||
},
|
}
|
||||||
"category": [
|
|
||||||
{
|
|
||||||
"@domain": "https://mwt.gov.na",
|
|
||||||
"#text": (.children[1] | [..|.text?|strings][0])
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"@domain": "https://mwt.gov.na",
|
|
||||||
"#text": (.children[4] | [..|.text?|strings][0])
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue