crap RSS piper

Forum rules
General talk about software - if the program is not in the repos, please links to the developer's page or github.
User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

crap RSS piper

Unread post by wuxmedia » 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...

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 :)
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: crap RSS piper

Unread post by wuxmedia » Wed Mar 02, 2016 9:29 am

wow, and a scrot, you guys are LUCKY!
2016-03-02-082752_3360x1050_scrot.png
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: crap RSS piper

Unread post by machinebacon » Wed Mar 02, 2016 10:10 am

cool. I love rss parsing :)
..gnutella..

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: crap RSS piper

Unread post by wuxmedia » Wed Mar 02, 2016 3:32 pm

^ thanks, looks like I do get updated news, so that's nice
"Seek, and Ye shall find"
"Github | Chooons | Site"

Post Reply