Monday 22 October 2007

Argotic : Turning an RSS Feed into a list(of T)

Now then,

Managed to find some useful RSS feeds of various channels (mainly BBC, but it'll do for now) from the good folks here:

http://bleb.org/tv/

So thats the first complication dealt with... no screen scraping for me.

I then set about turning the feed into a collection of Programme objects. I'd heard about Argotic Syndication Framework a while ago so I decided to give it a shot.

Initial thoughts are... nice and easy to use and it just seems to work...

The code I'm using at the moment:

Dim pList As New System.Collections.Generic.List(Of TellyBook.Programme)()
Dim feedUri As New Uri("http://bleb.org/tv/data/rss.php?ch=bbc1&day=0")
Dim feed As RssFeed = RssFeed.Create(feedUri)

For Each item As RssItem In feed.Channel.Items
Dim p As New TellyBook.Programme
p.Title = item.Title.Substring(6, (item.Title.Length - 6))
p.Time = item.Title.Substring(0, 4)
p.Description = item.Description
p.Channel = c.Name

If p.Time > currentTime Then
pList.Add(p)
End If
Next


That was simple. So... here's the breaks. Got an RSS feed you wanna turn into a collection of objects, give Argotic Syndication Framework a go....

No comments: