Add derstandard RSS helper script

This commit is contained in:
Agent 2026-02-03 21:41:01 +00:00
parent b9e1597556
commit b7c5344a66
6 changed files with 143 additions and 47 deletions

48
bin/derstandard Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
# Der Standard RSS helper - fetches via internal fivefilters
set -e
FIVEFILTERS_URL="https://fivefilters.cloonar.com"
FIVEFILTERS_IP="10.42.97.5"
RSS_SOURCE="https://www.derstandard.at/rss"
# Resolve to internal IP (bypasses web_fetch private IP block)
CURL="curl -sk --resolve fivefilters.cloonar.com:443:${FIVEFILTERS_IP}"
usage() {
cat <<EOF
Usage: derstandard <command> [args]
Commands:
urls [max] Extract article URLs (default: 50)
titles [max] Extract article titles
items [max] Title + URL pairs (tab-separated)
raw [max] Raw RSS XML
EOF
}
fetch_feed() {
local max="${1:-50}"
local encoded_url=$(printf '%s' "$RSS_SOURCE" | sed 's/:/%3A/g; s/\//%2F/g')
$CURL "${FIVEFILTERS_URL}/makefulltextfeed.php?url=${encoded_url}&max=${max}&links=preserve&exc="
}
case "${1:-}" in
urls)
fetch_feed "${2:-50}" | grep -oP '<link>\K[^<]+' | grep "derstandard.at/story"
;;
titles)
fetch_feed "${2:-50}" | grep -oP '<title><!\[CDATA\[\K[^\]]+' | tail -n +2
;;
items)
feed=$(fetch_feed "${2:-50}")
paste <(echo "$feed" | grep -oP '<title><!\[CDATA\[\K[^\]]+' | tail -n +2) \
<(echo "$feed" | grep -oP '<link>\K[^<]+' | grep "derstandard.at/story") 2>/dev/null | head -50
;;
raw)
fetch_feed "${2:-50}"
;;
*)
usage
;;
esac