diff --git a/feedgen.sh b/feedgen.sh index 2c2060f..fe7336a 100755 --- a/feedgen.sh +++ b/feedgen.sh @@ -119,14 +119,14 @@ log Building BFU English feed to $DIR/feeds/bfu/en.xml mkdir -p $DIR/feeds/bfu curl -s 'https://www.bfu-web.de/EN/Publications/Investigation%20Report/reports_node.html?cms_gts=238148_list%253DdateOfIssue_dt%252Bdesc' \ | pup 'table.links tbody tr json{}' \ - | jq -f $DIR/jq/bfu/en.jq \ + | jq -L $DIR/jq -f $DIR/jq/bfu/en.jq \ | json2xml > $DIR/feeds/bfu/en.xml.new \ && mv $DIR/feeds/bfu/en.xml.new $DIR/feeds/bfu/en.xml log Building BFU Deutsch feed to $DIR/feeds/bfu/de.xml curl -s 'https://www.bfu-web.de/DE/Publikationen/Untersuchungsberichte/untersuchungsberichte_node.html?cms_gts=235998_list%253DdateOfIssue_dt%252Bdesc' \ | pup 'table.links tbody tr json{}' \ - | jq -f $DIR/jq/bfu/de.jq \ + | jq -L $DIR/jq -f $DIR/jq/bfu/de.jq \ | json2xml > $DIR/feeds/bfu/de.xml.new \ && mv $DIR/feeds/bfu/de.xml.new $DIR/feeds/bfu/de.xml diff --git a/jq/bfu/de.jq b/jq/bfu/de.jq index 594b3e4..c1fcf06 100644 --- a/jq/bfu/de.jq +++ b/jq/bfu/de.jq @@ -1,6 +1,7 @@ # BFU English feed generator # Expects pup JSON output holding 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": { @@ -16,7 +17,13 @@ "generator": "ITSB", "item": [.[] | { "title": (.children[3].children[0].text + ": " + .children[2].text + ", " + .children[1].text), - "link": ("https://www.bfu-web.de" + .children[3].children[0].href), + "link": ( + .children[3].children[0].href + | helpers::urlparse + # Remove jsessionid path parameter + | .params = null + | helpers::urlresolve("https://www.bfu-web.de") + ), "pubDate": (.children[0].text | strptime("%d.%m.%Y") | mktime | strftime("%a, %d %b %Y %T %z")) }] } diff --git a/jq/bfu/en.jq b/jq/bfu/en.jq index 337f869..1d01e7b 100644 --- a/jq/bfu/en.jq +++ b/jq/bfu/en.jq @@ -1,6 +1,7 @@ # BFU English feed generator # Expects pup JSON output holding 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": { @@ -16,7 +17,13 @@ "generator": "ITSB", "item": [.[] | { "title": (.children[3].children[0].text + ": " + .children[2].text + ", " + .children[1].text), - "link": ("https://www.bfu-web.de" + .children[3].children[0].href), + "link": ( + .children[3].children[0].href + | helpers::urlparse + # Remove jsessionid path parameter + | .params = null + | helpers::urlresolve("https://www.bfu-web.de") + ), "pubDate": (.children[0].text | strptime("%Y.%m.%d") | mktime | strftime("%a, %d %b %Y %T %z")) }] }