Monday, June 15, 2009

Reading an RSS feed in groovy

Here's a small script to read RSS feeds from any site using groovy. You can customize it to read from multiple feeds by feeding the url's from a file etc.

def url=''
def channel=new XmlParser().parse(url).channel[0]
println channel.title.text()
println channel.description.text()
println '\nStories:\n---------'
def items=channel.item
for(item in items){
println item.title.text()
println item.description.text()

The emperor and me beaching

The Devil next door

Kaiser The Emperor