summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/rss/ratt-hourly.sh
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2022-05-02 22:25:19 +0200
committermakefu <github@syntax-fehler.de>2022-05-02 22:57:31 +0200
commit5187d0ac208deb06eff3bafb7ffd2fc32286b46a (patch)
tree17e595c8c9aecb5b3d21f07bdee4527af0b9a4f9 /makefu/2configs/deployment/rss/ratt-hourly.sh
parentbdd36774f5e0854553b13433ef85260c6c074b3e (diff)
ma rss: deploy ratt job
Diffstat (limited to 'makefu/2configs/deployment/rss/ratt-hourly.sh')
-rwxr-xr-xmakefu/2configs/deployment/rss/ratt-hourly.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/makefu/2configs/deployment/rss/ratt-hourly.sh b/makefu/2configs/deployment/rss/ratt-hourly.sh
new file mode 100755
index 000000000..67f2529bd
--- /dev/null
+++ b/makefu/2configs/deployment/rss/ratt-hourly.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -eu
+URLS=${1?must provide URLS file}
+OUTFILE=${2:-all.xml}
+
+echo "init, writing to $OUTFILE"
+
+cat > "$OUTFILE" <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
+ <channel>
+ <title>makefu Ebay Kleinanzeigen</title>
+ <link>https://www.ebay-kleinanzeigen.de/</link>
+ <description>Feed for all kleinanzeigen</description>
+ <pubDate>$(date '+%a, %d %b %Y %H:%M:%S %z')</pubDate>
+EOF
+echo "looping through $URLS"
+cat "$URLS" | while read line;do
+ echo "fetching $line"
+ ratt auto "$line" | \
+ xmlstarlet sel -t -c "//item" >> "$OUTFILE" || :
+done
+
+echo "close"
+cat >> "$OUTFILE" <<EOF
+ </channel>
+</rss>
+EOF