Register
It is currently Wed Apr 16, 2014 9:49 pm

RSS Feed...


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sat Dec 29, 2007 12:47 pm   

Joined: Thu Dec 27, 2007 12:15 pm
Posts: 1
Anyone out there who got a working BASH script to show RSS feeds from multiple websites?
The ones I find on ze google is very... sucky. ^_^

Thanks.


Top
 Profile  
 PostPosted: Tue Feb 05, 2008 9:50 am   

Joined: Tue Feb 05, 2008 8:24 am
Posts: 14
Which information you would like to show?

Basicaly, you can do anything with xmlstarlet (RSS is XML). Fetch feeds with wget or curl. Print what you need.

Given one feed,
Code:
# define your feed url
RSS_URL=http://feeds.feedburner.com/usefreetools

# use "wget -O -" or "curl -g ${RSS_URL} -s"
wget ${RSS_URL} -O - 2>/dev/null | \
xmlstarlet sel -t -m "/rss/channel/item" \
   -v "guid" -n -v "pubDate" -n \
   -v "title" -n -v "link" -n \
        -v "description" -n -n


This will work for RSS2.0.

Do the same in with multiple feeds. Something like this:

Code:
RSS_LIST[0]=url1
RSS_LIST[1]=url2
RSS_LIST[2]=url3
# ...
for r in ${RSS_LIST[@]} ; do
wget ${r} -O - 2>/dev/null | \
xmlstarlet sel -t -m "/rss/channel/item" \
   -v "guid" -n -v "pubDate" -n \
   -v "title" -n -v "link" -n \
        -v "description" -n -n ;
done

P.S. Crossposted this tip also to my blog: How to parse RSS 2.0 in bash


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP