Flickr RSS - Obtaining the media:thumbnail tag

Topics: Argotic.Extensions
Jun 20, 2007 at 9:24 PM

First off, great library, loving argotic. I'm writing an application that requires multiple RSS feeds from various sources, one of them being Flickr. I noticed that the extensions are included in the library but I can't quite figure out how to get it to work. If anyone has some examples I would greatly appreciate it. Below is my current code:

Uri feeduri = new Uri(FeedUrl);
RssFeed feed = RssFeed.Create(feeduri);

foreach (RssItem item in feed.Channel.Items)
if (item.PublicationDate <= LastUpdated)

// get the extension here need URL
//<media:thumbnail url="" height="75" width="75" />

dbFeed.InsertFeedItem(feedtype, item.Author, item.Description, item.Guid.Value, item.Link.AbsoluteUri, item.PublicationDate, item.Title, id,/*MEDIATHUMBNAIL goes here */);

What I would like to get is the URL from the flickr RSS feeds:

<media:thumbnail url="" height="75" width="75" />

Jun 20, 2007 at 9:44 PM
By default the framework does not parse syndication extensions. In the future the framework will automatically parse syndication extensions by examining the XML namespaces available in a feed's XML data.

For now you will need to call the RssFeed.Create(Uri, SyndicationFeedSettings) method, and pass in a settings instance with the extension(s) you are interested in added to the settings SupportedExtensions collection.

A basic example of consuming an extended feed can be found at [discussion:10777].
Jun 21, 2007 at 1:38 PM
I've posted the solution I worked out below in case it helps anyone else out parsing RSS feeds from flickr:

private static void RSSUpdateFeeds(DateTime LastUpdated, string FeedUrl, int id, int feedtype)
String thumbUrl = "";
Uri feeduri = new Uri(FeedUrl);
SyndicationFeedSettings settings = new SyndicationFeedSettings();
settings.SupportedExtensions.Add(new MediaSyndicationExtension());//media syndication extensions
RssFeed feed = RssFeed.Create(feeduri,settings); //add those settings when creating the RssFeed

foreach (RssItem item in feed.Channel.Items)//loop through items
if (item.PublicationDate <= LastUpdated)//don't care about items older than the previous pub date
foreach (SyndicationExtension extension in item.Extensions.Values) //loop through extensions
if (extension.GetType() == typeof(MediaSyndicationExtension)) //if type media (where thumb is)
MediaSyndicationExtension mediaExtension = (MediaSyndicationExtension)extension;
thumbUrl = mediaExtension.Thumbnail.Url.ToString(); //get the thumbnail
//add item to db
dbFeed.InsertFeedItem(feedtype, item.Author, item.Description, thumbUrl, item.Guid.Value, item.Link.AbsoluteUri, item.PublicationDate, item.Title, id);
//update publication date of that feed
dbFeed.updateFeedDate(id, feed.Channel.PublicationDate);

Thanks for the advice, I had read through that example before but somehow missed adding the settings to the actual createFeed.