Rewrite Denmark feeds

This commit is contained in:
Lucidiot 2021-02-22 21:42:23 +01:00
parent 1022b7b2da
commit f922078daf
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
1 changed files with 26 additions and 12 deletions

View File

@ -24,18 +24,32 @@
"docs": "https://www.rssboard.org/rss-specification",
"ttl": 1440,
"generator": "ITSB",
"item": [.[] | {
"title": first(.children[-1].children[] | select(.tag == "h3")).children[0].text,
"description": first(.children[-1].children[] | select(.tag == "p")).text,
"link": .["data-url"],
"pubDate": (first(.children[-1].children[] | select(.class == "date")).text[-10:] | strptime("%d-%m-%Y") | mktime | strftime("%a, %d %b %Y %T %z")),
"category": [.children[-1].children[] | select(.class == "labels") | .children[].text],
"http://search.yahoo.com/mrss/:thumbnail": (
if .children[0].class == "media-left" then {
"@url": .children[0].children[0].src
} else empty end
)
}]
"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
]
}
}
}