Page 1 of 1

crap RSS piper

Posted: Wed Mar 02, 2016 9:05 am
by wuxmedia
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...

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
for the i3 bar.sh:

Code: Select all

cat /tmp/rss.feed
Not entirely sure if the nested 'for' loops actually work, I guess if it's the same news all day, it doesn't work :)

Re: crap RSS piper

Posted: Wed Mar 02, 2016 9:29 am
by wuxmedia
wow, and a scrot, you guys are LUCKY!
2016-03-02-082752_3360x1050_scrot.png

Re: crap RSS piper

Posted: Wed Mar 02, 2016 10:10 am
by machinebacon
cool. I love rss parsing :)

Re: crap RSS piper

Posted: Wed Mar 02, 2016 3:32 pm
by wuxmedia
^ thanks, looks like I do get updated news, so that's nice