Call new GoBasic API for Danish reports
continuous-integration/drone Build is passing
Details
continuous-integration/drone Build is passing
Details
This commit is contained in:
parent
6b1950309c
commit
aba2b321d8
54
itsb.xml
54
itsb.xml
|
@ -415,13 +415,23 @@
|
|||
<url>https://havarikommissionen.dk/</url>
|
||||
<feed format="rss" lang="Danish, English" type="aviation" id="aibd-aviation">
|
||||
<curl>
|
||||
<url>https://en.havarikommissionen.dk/aviation-archive/</url>
|
||||
<url>https://en.havarikommissionen.dk/investigation-results/search-aviation/</url>
|
||||
</curl>
|
||||
<pup>ul.items > li[data-url]</pup>
|
||||
<jq path="denmark.jq">
|
||||
<pup output="text">.archive-search-result + script</pup>
|
||||
<shell><![CDATA[grep -o '{.*}']]></shell>
|
||||
<jq path="denmark/query.jq">
|
||||
<arg name="category"></arg>
|
||||
</jq>
|
||||
<curl>
|
||||
<url>https://en.havarikommissionen.dk/proxy.gba</url>
|
||||
<requestBody>@-</requestBody>
|
||||
</curl>
|
||||
<jq path="denmark/extract.jq" raw-output="true" />
|
||||
<pup>.item[data-url]</pup>
|
||||
<jq path="denmark/build.jq">
|
||||
<arg name="title">AIBD Aviation</arg>
|
||||
<arg name="description">Accident Investigation Board Denmark aviation accident reports</arg>
|
||||
<arg name="link">https://en.havarikommissionen.dk/aviation-archive/</arg>
|
||||
<arg name="link">https://en.havarikommissionen.dk/investigation-results/search-aviation/</arg>
|
||||
</jq>
|
||||
<json2xml short-empty="true">
|
||||
<namespace prefix="media">http://search.yahoo.com/mrss/</namespace>
|
||||
|
@ -430,13 +440,23 @@
|
|||
</feed>
|
||||
<feed format="rss" lang="Danish, English" type="rail" id="aibd-rail">
|
||||
<curl>
|
||||
<url>https://en.havarikommissionen.dk/railway-archive/</url>
|
||||
<url>https://en.havarikommissionen.dk/investigation-results/search-railway/</url>
|
||||
</curl>
|
||||
<pup>ul.items > li[data-url]</pup>
|
||||
<jq path="denmark.jq">
|
||||
<pup output="text">.archive-search-result + script</pup>
|
||||
<shell><![CDATA[grep -o '{.*}']]></shell>
|
||||
<jq path="denmark/query.jq">
|
||||
<arg name="category"></arg>
|
||||
</jq>
|
||||
<curl>
|
||||
<url>https://en.havarikommissionen.dk/proxy.gba</url>
|
||||
<requestBody>@-</requestBody>
|
||||
</curl>
|
||||
<jq path="denmark/extract.jq" raw-output="true" />
|
||||
<pup>.item[data-url]</pup>
|
||||
<jq path="denmark/build.jq">
|
||||
<arg name="title">AIBD Rail</arg>
|
||||
<arg name="description">Accident Investigation Board Denmark railroad accident reports</arg>
|
||||
<arg name="link">https://en.havarikommissionen.dk/railway-archive/</arg>
|
||||
<arg name="link">https://en.havarikommissionen.dk/investigation-results/search-railway/</arg>
|
||||
</jq>
|
||||
<json2xml short-empty="true">
|
||||
<namespace prefix="media">http://search.yahoo.com/mrss/</namespace>
|
||||
|
@ -453,13 +473,23 @@
|
|||
<url>https://dmaib.com/</url>
|
||||
<feed format="rss" lang="Danish, English" id="dmaib-rss">
|
||||
<curl>
|
||||
<url>https://dmaib.com/reports/?categorizations=9510</url>
|
||||
<url>https://dmaib.com/reports/</url>
|
||||
</curl>
|
||||
<pup>ul.items > li[data-url]</pup>
|
||||
<jq path="denmark.jq">
|
||||
<pup output="text">.archive-search-result + script</pup>
|
||||
<shell><![CDATA[grep -o '{.*}']]></shell>
|
||||
<jq path="denmark/query.jq">
|
||||
<arg name="category">8384</arg>
|
||||
</jq>
|
||||
<curl>
|
||||
<url>https://dmaib.com/proxy.gba</url>
|
||||
<requestBody>@-</requestBody>
|
||||
</curl>
|
||||
<jq path="denmark/extract.jq" raw-output="true" />
|
||||
<pup>.item[data-url]</pup>
|
||||
<jq path="denmark/build.jq">
|
||||
<arg name="title">DMAIB</arg>
|
||||
<arg name="description">Danish Maritime Accident Investigation Board accident reports</arg>
|
||||
<arg name="link">https://dmaib.com/reports/?categorizations=9510</arg>
|
||||
<arg name="link">https://dmaib.com/reports/</arg>
|
||||
</jq>
|
||||
<json2xml short-empty="true">
|
||||
<namespace prefix="media">http://search.yahoo.com/mrss/</namespace>
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
# Denmark feed generator
|
||||
# Compatible with AIBD Aviation https://en.havarikommissionen.dk/aviation-archive/
|
||||
# Compatible with AIBD Rail https://en.havarikommissionen.dk/railway-archive/
|
||||
# Compatible with DMAIB https://dmaib.com/reports/?categorizations=9510
|
||||
# Accident Investigation Board Denmark and Danish Maritime Accident Investigation Board feed generator
|
||||
# Required arguments:
|
||||
# $title: Channel title
|
||||
# $description: Channel description
|
||||
# $link: Channel link
|
||||
# Expects pup JSON output holding <li> tags, outputs xmltodict-compatible JSON
|
||||
# Expects pup JSON output holding <div class="item"> tags, outputs xmltodict-compatible JSON
|
||||
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
||||
import "./helpers" as helpers;
|
||||
|
||||
|
@ -20,7 +17,7 @@ import "./helpers" as helpers;
|
|||
"title": $title,
|
||||
"description": $description,
|
||||
"link": $link,
|
||||
"language": "en",
|
||||
"language": "en-DK",
|
||||
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
||||
"docs": "https://www.rssboard.org/rss-specification",
|
||||
"ttl": 1440,
|
||||
|
@ -29,27 +26,28 @@ import "./helpers" as helpers;
|
|||
.[]
|
||||
| . as $item
|
||||
| {
|
||||
"title": .children[-1].children[0].children[0].text,
|
||||
"title": .children[-1].children[-4].children[0].text,
|
||||
"description": .children[-1].children[-1].text,
|
||||
"link": (.["data-url"] | helpers::urlresolve($link)),
|
||||
"guid": (.["data-url"] | helpers::urlresolve($link)),
|
||||
"pubDate": (
|
||||
.children[-1].children[1].text[-10:]
|
||||
.children[-1].children[-3].text
|
||||
| if startswith("Published ") then .[-10:] else . end
|
||||
| strptime("%d-%m-%Y")
|
||||
| mktime
|
||||
| strftime("%a, %d %b %Y %T %z")
|
||||
),
|
||||
"category": [
|
||||
.children[-1].children[2].children[].text | {
|
||||
.children[-1].children[-2].children[].children[0].text | {
|
||||
"@domain": $link,
|
||||
"#text": .
|
||||
}
|
||||
]
|
||||
}
|
||||
# Optional MediaRSS thumbnail
|
||||
| if $item.children[0].class == "media-left" then
|
||||
| if $item.children[0].class == "media" then
|
||||
.["http://search.yahoo.com/mrss/:thumbnail"] = {
|
||||
"@url": ($item.children[0].children[0].src | helpers::urlresolve($link))
|
||||
"@url": ($item.children[0].children[0].children[-1].src | helpers::urlresolve($link))
|
||||
}
|
||||
else . end
|
||||
]
|
|
@ -0,0 +1 @@
|
|||
.value.page
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"control": "GoBasic.Presentation.Controls.ListHelper, GoBasic.Presentation",
|
||||
"method": "GetPage",
|
||||
"path": "",
|
||||
"query": "",
|
||||
"args": {
|
||||
"arg0": .,
|
||||
"arg1": 1,
|
||||
"arg2": {"categorizations": ([$category] | map(select(length > 0)))},
|
||||
"arg3": "",
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue