Fix BEA custom feed
This commit is contained in:
parent
64ae2ee948
commit
6b1950309c
6
itsb.xml
6
itsb.xml
|
@ -338,11 +338,9 @@
|
|||
<curl>
|
||||
<url verify-ssl="false">https://bea.aero/les-enquetes/evenements-notifies/?tx_news_pi1%5Baction%5D=searchResult&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5BfacetAction%5D=add&tx_news_pi1%5BfacetTitle%5D=etat_intS&tx_news_pi1%5BfacetValue%5D=100&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>
|
||||
|
|
32
jq/bea.jq
32
jq/bea.jq
|
@ -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("'"; "'")),
|
||||
"title": (.children[0].children[-1].children[0].title | gsub("'"; "'")),
|
||||
"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("'"; "'")
|
||||
]
|
||||
| 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/"))
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue