56 lines
2.1 KiB
Plaintext
56 lines
2.1 KiB
Plaintext
# 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
|
|
# Required arguments:
|
|
# $title: Channel title
|
|
# $description: Channel description
|
|
# $link: Channel link
|
|
# Expects pup JSON output holding <li> tags, outputs xmltodict-compatible JSON
|
|
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
|
|
|
{
|
|
"rss": {
|
|
"@version": "2.0",
|
|
"@xmlns": {
|
|
"media": "http://search.yahoo.com/mrss/"
|
|
},
|
|
"channel": {
|
|
"title": $title,
|
|
"description": $description,
|
|
"link": $link,
|
|
"language": "en",
|
|
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
|
"docs": "https://www.rssboard.org/rss-specification",
|
|
"ttl": 1440,
|
|
"generator": "ITSB",
|
|
"item": [
|
|
.[]
|
|
| . as $item
|
|
| {
|
|
"title": .children[-1].children[0].children[0].text,
|
|
"description": .children[-1].children[-1].text,
|
|
"link": .["data-url"],
|
|
"guid": .["data-url"],
|
|
"pubDate": (
|
|
.children[-1].children[1].text[-10:]
|
|
| strptime("%d-%m-%Y")
|
|
| mktime
|
|
| strftime("%a, %d %b %Y %T %z")
|
|
),
|
|
"category": [
|
|
.children[-1].children[2].children[].text | {
|
|
"@domain": $link,
|
|
"#text": .
|
|
}
|
|
]
|
|
}
|
|
# Optional MediaRSS thumbnail
|
|
| if $item.children[0].class == "media-left" then
|
|
.["http://search.yahoo.com/mrss/:thumbnail"] = {"@url": $item.children[0].children[0].src}
|
|
else . end
|
|
]
|
|
}
|
|
}
|
|
}
|