crap RSS piper
Posted: Wed Mar 02, 2016 9:05 am
Probably could be done better, but an exercise in sed and newlines and shit:
dumped line by line to a tmp file and read by i3 bar.sh, or anything really...
for the i3 bar.sh:
Not entirely sure if the nested 'for' loops actually work, I guess if it's the same news all day, it doesn't work :)
dumped line by line to a tmp file and read by i3 bar.sh, or anything really...
Code: Select all
#!/bin/bash
## BBC RSS ripper, to a file read by /bin/bar.sh
while :
do
RSS=$(curl --silent "http://feeds.bbci.co.uk/news/rss.xml?edition=uk" | grep -E '(title>|description>)' | grep -v "BBC News" | sed -e 's/<\/[^>]*>/\n/g' -e 's/<[^>]*>//g' | sed '/^\s*$/d' | sed -e 's/^[ \t]*//')
IFS=$'\n'
for i in $RSS
do
echo -ne "$i | " > /tmp/rss.feed
sleep 11s
done
sleep 100s
done
Code: Select all
cat /tmp/rss.feed