With .net 3.5, there is a SyndicationFeed that will load in a RSS feed and allow you to run LINQ on it.
Here is an example of the RSS that I am loading:
<
Here is how I managed to retrieve the enclosure link from a feed using SyndicationFeed.
static void Main(string[] args)
{
var feedUrl = "http://blog.stackoverflow.com/index.php?feed=podcast";
using (var feedReader = XmlReader.Create(feedUrl))
{
var feedContent = SyndicationFeed.Load(feedReader);
if (null == feedContent) return;
foreach (var item in feedContent.Items)
{
Debug.WriteLine("Item Title: " + item.Title.Text);
Debug.WriteLine("Item Links");
foreach (var link in item.Links)
{
Debug.WriteLine("Link Title: " + link.Title);
Debug.WriteLine("URI: " + link.Uri);
Debug.WriteLine("RelationshipType: " + link.RelationshipType);
Debug.WriteLine("MediaType: " + link.MediaType);
Debug.WriteLine("Length: " + link.Length);
}
}
}
}
The output is as follows:
Item Title: Podcast #50
Item Links
Link Title:
URI: http://blog.stackoverflow.com/2009/04/podcast-50/
RelationshipType: alternate
MediaType:
Length: 0
Link Title:
URI: http://itc.conversationsnetwork.org/audio/download/ITC.SO-Episode50-2009.04.21.mp3
RelationshipType: enclosure
MediaType: audio/mpeg
Length: 36580016
You can identify the enclosure link from its relationship type.