Fix date handling in BEA feed

This commit is contained in:
Lucidiot 2021-03-18 14:13:48 +01:00
parent 454f3b4608
commit 6d97869d19
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
1 changed files with 21 additions and 25 deletions

View File

@ -18,31 +18,27 @@ import "./helpers" as helpers;
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"item": [
.[]
| . as $item
| {
"title": (.children[1].children[1].title | gsub("'"; "'")),
"description": (
[
.children[0].children[1].children[].children
| .[0].text + " : " + ((.[1].children[0] | .text // .children[0].text) // .[1].text)
| gsub("'"; "'")
]
| join("</li><li>")
| "<ul><li>\(.)</li></ul>"
),
"link": (.children[1].children[1].href | helpers::urlresolve("https://bea.aero/")),
"guid": (.children[1].children[1].href | helpers::urlresolve("https://bea.aero/")),
"pubDate": (
[(.children[0].children[1].children[].children[].children // [])[].datetime | strings][0]
| strptime("%Y-%m-%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
),
"georss:point": (.children[2].text | [match("', (-?[0-9.]+), (-?[0-9.]+)") | .captures[].string] | join(" "))
}
]
"item": [.[] | {
"title": (.children[1].children[1].title | gsub("&#39;"; "'")),
"description": (
[
.children[0].children[1].children[].children
| .[0].text + " : " + ((.[1].children[0] | .text // .children[0].text) // .[1].text)
| gsub("&#39;"; "'")
]
| join("</li><li>")
| "<ul><li>\(.)</li></ul>"
),
"link": (.children[1].children[1].href | helpers::urlresolve("https://bea.aero/")),
"guid": (.children[1].children[1].href | helpers::urlresolve("https://bea.aero/")),
"pubDate": (
[.children[0].children[1].children[].children[].children[]?.children[0].text | strings][0]
| strptime("%d/%m/%Y")
| mktime
| strftime("%a, %d %b %Y %T %z")
),
"georss:point": (.children[2].text | [match("', (-?[0-9.]+), (-?[0-9.]+)") | .captures[].string] | join(" "))
}]
}
}
}