Read Media Element in Atom

Topics: Argotic.Extensions
Mar 31, 2008 at 1:03 PM
I'd like to read an atom feed with yahoo media namespace. How can I do that?
Mar 31, 2008 at 2:56 PM

The infrastructure/API for consuming and generating syndication extensions applies regardless of whether you are consuming an RSS or Atom feed.

using Argotic.Extensions.Core;
using Argotic.Syndication;
//  Retrieve extended syndication feed
AtomFeed feed    = AtomFeed.Create(new Uri(""));
//  Verify feed is extended
if (feed.HasExtensions)
    //  Retrieve Yahoo! media syndication extension for feed using predicate-based search
    YahooMediaSyndicationExtension mediaFeedExtension   = feed.FindExtension(YahooMediaSyndicationExtension.MatchByType) as YahooMediaSyndicationExtension;
    if (mediaFeedExtension != null)
        // Process feed media extension information
foreach (AtomEntry entry in feed.Entries)
    //  Verify feed entry is extended
    if (entry.HasExtensions)
        //  Retrieve Yahoo! media syndication extension for feed entry using predicate-based search
        YahooMediaSyndicationExtension mediaEntryExtension  = entry.FindExtension(YahooMediaSyndicationExtension.MatchByType) as YahooMediaSyndicationExtension;
        if (mediaEntryExtension != null)
            // Process media extension information for current feed entry

Please let me know if you have further questions, and I will add some Atom specific examples on the project wiki to clarify this question.
Jun 25, 2008 at 7:33 PM

I'm attempting to do exactly what is in the example for a YouTube feed ( and while Argotic does find the YahooMediaSyndicationExtension all of it's members are either null or empty.  Am I doing something wrong or is there an issue with Argotic parsing the extension data?

Thanks again,
Jun 25, 2008 at 7:38 PM
My mistake, it looks like I just had to drill down further to Context.Groups.
Jun 25, 2008 at 8:15 PM
Good to hear, glad to know all is working as expected.