topic title: RSS in Conky
Posts: 452
Jerry
Joined: 12 Sep 2007
#1
Along the line of practical items, I have adapted this script to display the current top item on CNN.com in Conky. (It requires the installation of curl from the repos.) My procedure (be sure to change my username"jb" to your own):

1) Open up Leafpad and paste in this code:

Code: Select all

# RSS Feed Display Script by Hellf[i]re v0.1
#
# This script is designed for most any RSS Feed. As some feeds may not be
# completely compliant, it may need a bit of tweaking
#
# This script depends on curl.
# Gentoo: emerge -av net-misc/curl
# Debian: apt-get install curl
# Homepage: http://curl.haxx.se/
#
# Usage:
# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh}
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh}

#RSS Setup
URI=http://rss.cnn.com/rss/cnn_topstories.rss #URI of RSS Feed
LINES=1 #Number of headlines

#Environment Setup
EXEC="/usr/bin/curl -s" #Path to curl

#Work Start
$EXEC $URI | grep title |\
sed -e :a -e 's/<[^>]*>//g;/</N' |\
sed -e 's/[ \t]*//' |\
sed -e 's/\(.*\)/ \1/' |\
sed -e 's/\.//' |\
sed -e 's/\"//' |\
sed -e 's/\"//' |\
head -n $(($LINES + 2)) |\
tail -n $(($LINES))
Change LINES= to as many feeds as you would like displayed.
2) save as conky-rss_CNN.sh in /home/jb/scripts , then right-click --> Permissions and click Yes to make it executable
3) paste the following at the bottom of conkyrc (colors personal):

Code: Select all

${color white}News:
 ${color green}${execi 300 /home/jb/scripts/conky-rss_CNN.sh}
Then save the file.
4) click Menu --> WM's --> Conky on/off twice to activate new config

NOTES: 1) You can add other feeds by creating additional copies of the script and changing the URL and the name. 2) Not all feeds work for me, especially those ending in xml such as from the BBC--maybe somebody can solve that?
Posts: 251
JawsThemeSwimming428
Joined: 16 Mar 2008
#2
Thanks, I plan to try that later tonight. Nice job.
Posts: 251
JawsThemeSwimming428
Joined: 16 Mar 2008
#3
OK, not sure why it doesn't work with feeds ending in .xml but I am getting the same result as you. At first it wasn't working but then I realized I hadn't installed curl. After installing curl everything worked fine. The only question I have is how do I allow the headline to take up more than one line in conky? For example, right now it says"Philadelphia's municipal WiFi n" and then it cuts it off because there is a character or line limit. I want it to show the entire title of the article. Thanks !
Posts: 452
Jerry
Joined: 12 Sep 2007
#4
I found that you can get a certain increase in width by changing this entry in your conkyrc file:

Code: Select all

maximum_width 300
But numbers greater than that seem to have no further effect. Something else must be limiting it, haven't figured out what yet.
Posts: 251
JawsThemeSwimming428
Joined: 16 Mar 2008
#5
Alright thanks. I will play around a little bit and let you know if I figure it out.