Fix BEA custom feed

This commit is contained in:
~lucidiot 2023-05-09 10:13:58 +02:00
parent 64ae2ee948
commit 6b1950309c
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
2 changed files with 14 additions and 24 deletions

View File

@ -338,11 +338,9 @@
<curl>
<url verify-ssl="false">https://bea.aero/les-enquetes/evenements-notifies/?tx_news_pi1%5Baction%5D=searchResult&amp;tx_news_pi1%5Bcontroller%5D=News&amp;tx_news_pi1%5BfacetAction%5D=add&amp;tx_news_pi1%5BfacetTitle%5D=etat_intS&amp;tx_news_pi1%5BfacetValue%5D=100&amp;cHash=b4645da2a30ec0c83f60069d018b5619</url>
</curl>
<pup>article.search-entry</pup>
<pup>.search-entry__event</pup>
<jq path="bea.jq" />
<json2xml>
<namespace prefix="georss">http://www.georss.org/georss</namespace>
</json2xml>
<json2xml />
<output>bea.xml</output>
</feed>
</source>

View File

@ -1,14 +1,11 @@
# BEA feed generator
# Expects pup JSON output holding <article> tags, outputs xmltodict-compatible JSON
# Expects pup JSON output holding <div class="search-entry__event"> tags, outputs xmltodict-compatible JSON
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
import "./helpers" as helpers;
{
"rss": {
"@version": "2.0",
"@xmlns": {
"georss": "http://www.georss.org/georss"
},
"channel": {
"title": "BEA",
"description": "Rapports d'enquête publiés par le Bureau d'Enquêtes et Analyses",
@ -19,25 +16,20 @@ import "./helpers" as helpers;
"ttl": 1440,
"generator": "ITSB",
"item": [.[] | {
"title": (.children[1].children[1].title | gsub("&#39;"; "'")),
"title": (.children[0].children[-1].children[0].title | gsub("&#39;"; "'")),
"description": (
[
.children[0].children[1].children[].children
| .[0].text + " : " + ((.[1].children[0] | .text // .children[0].text) // .[1].text)
"<p>" + .children[0].children[-1].children[1].text + "</p>" + (
[
.children[1].children[].children
| "<dt>\(.[0].text)</dt><dd>\(.[1].children[0].text)</dd>"
]
| join("")
| if length then "<dl>\(.)</dl>" else "" end
| 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")
),
"http://www.georss.org/georss:point": (.children[2].text | [match("', (-?[0-9.]+), (-?[0-9.]+)") | .captures[].string] | join(" "))
"link": (.children[0].children[-1].children[0].href | helpers::urlresolve("https://bea.aero/")),
"guid": (.children[0].children[-1].children[0].href | helpers::urlresolve("https://bea.aero/"))
}]
}
}