使用SyndicationFeed从RSS获取媒体元素 [英] Get media elements from RSS using SyndicationFeed

查看:85
本文介绍了使用SyndicationFeed从RSS获取媒体元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用C#和SyndicationFeed类解析RSS feed.我正在遍历这些项目以获取SyndicationItems的列表,并且该列表公开了大多数Feed属性,但是我无法弄清的是media:thumbnail元素:

I'm attempting to parse an RSS feed using C# and the SyndicationFeed class. I'm iterating over the items to get a list of SyndicationItems and that is exposing most of the feed properties, but what I cannot get out is the media:thumbnail element:

    <?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
    xmlns:media="http://search.yahoo.com/mrss/"
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:ddn="http://discoverydn.com/about">
  <channel>
    <title>Revision3 Feed</title>
    <link>http://revision3.com/user/1564421</link>
    <description>Customized RSS Feed of all your favorite Revision3 shows.</description>
    <language>en-us</language>
    <itunes:explicit>no</itunes:explicit>
    <itunes:summary></itunes:summary>
    <itunes:subtitle></itunes:subtitle>
    <itunes:author>Revision3</itunes:author>
    <itunes:owner>
      <itunes:email>feedback@revision3.com</itunes:email>
      <itunes:name>Revision3</itunes:name>
    </itunes:owner>
    <itunes:image href="http://revision3.com/forum/image.php?u=415677" />
    <itunes:keywords />
    <image>
      <title>Revision3 Feed</title>
      <width>100</width>
      <height>100</height>
      <link>http://revision3.com/user/1564221</link>
      <url>http://revision3.com/forum/image.php?u=415677</url>
    </image>
    <atom:link rel="self" type="application/rss+xml" title="Revision3 Feed" href="http://revision3.com/feed/user/0a7ehtg09b0ab0/" />
    <item>
      <title>Tekzilla Bites - Toyota Announces New Zero-Emission Fuel Cell Vehicle For 2015!</title>
      <link>http://revision3.com/tekzillabites/toyota-fuel-cell</link>
      <description>
&lt;p&gt;This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota&apos;s announced specs, right from the CES show floor.
&lt;/p&gt;
      </description>
      <content:encoded>
&lt;p&gt;This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota&apos;s announced specs, right from the CES show floor.
&lt;/p&gt;
      </content:encoded>
      <author>feedback@revision3.com (Revision3)</author>
      <pubDate>Tue, 07 Jan 2014 07:00:00 GMT</pubDate>
      <itunes:image href="http://revision3.com/forum/image.php?u=415677" />
      <itunes:duration>154</itunes:duration>
      <itunes:explicit>no</itunes:explicit>
      <itunes:keywords>toyota, fuel cell vehicle, hydrogen electric, hydrogen electricity, fcv, fuel cell, water exhaust, electric car, ces 2014</itunes:keywords>
      <itunes:author>Revision3</itunes:author>
      <itunes:subtitle>
This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota's announced specs, 
      </itunes:subtitle>
      <guid isPermaLink="false">/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--hd720p30.h264.mp4</guid>
      <enclosure url="http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--hd720p30.h264.mp4" length="27874999" type="video/mp4" />
      <media:content duration="154" medium="video" fileSize="27874999" url="http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--hd720p30.h264.mp4" type="video/mp4">
        <media:title>Tekzilla Bites - Toyota Announces New Zero-Emission Fuel Cell Vehicle For 2015!</media:title>
        <media:description>
&lt;p&gt;This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota&apos;s announced specs, right from the CES show floor.
&lt;/p&gt;
        </media:description>
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--marge.thumb.jpg" width="640" height="360" />
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--medium.thumb.jpg" width="300" height="169" />
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--mini.thumb.jpg" width="100" height="100" />
        <media:player url="http://revision3.com/tekzillabites/toyota-fuel-cell" />
        <media:rating>nonadult</media:rating>
        <media:keywords>toyota, fuel cell vehicle, hydrogen electric, hydrogen electricity, fcv, fuel cell, water exhaust, electric car, ces 2014</media:keywords>
      </media:content>
      <ddn:id>28583</ddn:id>
    </item>
    <item>
      <title>Film Riot - Mondays: Getting Recognized, Poster Credits &amp; Royalty Free Music!</title>
      <link>http://revision3.com/filmriot/poster-credits</link>
      <description>
Ryan opens up the mail sack and answers some questions!
      </description>
      <content:encoded>
Ryan opens up the mail sack and answers some questions!
      </content:encoded>
      <author>feedback@revision3.com (Revision3)</author>
      <pubDate>Tue, 07 Jan 2014 05:00:00 GMT</pubDate>
      <itunes:image href="http://revision3.com/forum/image.php?u=415677" />
      <itunes:duration>522</itunes:duration>
      <itunes:explicit>no</itunes:explicit>
      <itunes:keywords>getting recognized, getting yourself out there, poster credits, royalty free music, music, getting permission to use music, film riot, mail sack, questions, answers, q&amp;a, ryan connolly</itunes:keywords>
      <itunes:author>Revision3</itunes:author>
      <itunes:subtitle>
Ryan opens up the mail sack and answers some questions!
      </itunes:subtitle>
      <guid isPermaLink="false">/filmriot/0364/filmriot--0364--poster-credits--hd720p30.h264.mp4</guid>
      <enclosure url="http://videos.revision3.com/revision3/web/filmriot/0364/filmriot--0364--poster-credits--hd720p30.h264.mp4" length="73676325" type="video/mp4" />
      <media:content duration="522" medium="video" fileSize="73676325" url="http://videos.revision3.com/revision3/web/filmriot/0364/filmriot--0364--poster-credits--hd720p30.h264.mp4" type="video/mp4">
        <media:title>Film Riot - Mondays: Getting Recognized, Poster Credits &amp; Royalty Free Music!</media:title>
        <media:description>
Ryan opens up the mail sack and answers some questions!
        </media:description>
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/filmriot/0364/filmriot--0364--poster-credits--marge.thumb.jpg" width="640" height="360" />
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/filmriot/0364/filmriot--0364--poster-credits--medium.thumb.jpg" width="300" height="169" />
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/filmriot/0364/filmriot--0364--poster-credits--mini.thumb.jpg" width="100" height="100" />
        <media:player url="http://revision3.com/filmriot/poster-credits" />
        <media:rating>nonadult</media:rating>
        <media:keywords>getting recognized, getting yourself out there, poster credits, royalty free music, music, getting permission to use music, film riot, mail sack, questions, answers, q&amp;a, ryan connolly</media:keywords>
      </media:content>
      <ddn:id>28579</ddn:id>
    </item>
    <item>
      <title>Tekzilla Bites - Roku&apos;s Smart TV, More Channels, No Box- CES 2014</title>
      <link>http://revision3.com/tekzillabites/roku-tv-ces-2014</link>
      <description>
&lt;p&gt;Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton has the details. &lt;/p&gt;
      </description>
      <content:encoded>
&lt;p&gt;Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton has the details. &lt;/p&gt;
      </content:encoded>
      <author>feedback@revision3.com (Revision3)</author>
      <pubDate>Tue, 07 Jan 2014 05:00:00 GMT</pubDate>
      <itunes:image href="http://revision3.com/forum/image.php?u=415677" />
      <itunes:duration>105</itunes:duration>
      <itunes:explicit>no</itunes:explicit>
      <itunes:keywords>roku tv, roku, tcl, hisense, ces2014, ces 2014, roku lt, ruku 1, streaming, stream, media, tekzilla, roku remote, set top box, coard cutting</itunes:keywords>
      <itunes:author>Revision3</itunes:author>
      <itunes:subtitle>
Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton 
      </itunes:subtitle>
      <guid isPermaLink="false">/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--hd720p30.h264.mp4</guid>
      <enclosure url="http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--hd720p30.h264.mp4" length="21262105" type="video/mp4" />
      <media:content duration="105" medium="video" fileSize="21262105" url="http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--hd720p30.h264.mp4" type="video/mp4">
        <media:title>Tekzilla Bites - Roku&apos;s Smart TV, More Channels, No Box- CES 2014</media:title>
        <media:description>
&lt;p&gt;Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton has the details. &lt;/p&gt;
        </media:description>
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--marge.thumb.jpg" width="640" height="360" />
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--medium.thumb.jpg" width="300" height="169" />
        <media:thumbnail url="http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--mini.thumb.jpg" width="100" height="100" />
        <media:player url="http://revision3.com/tekzillabites/roku-tv-ces-2014" />
        <media:rating>nonadult</media:rating>
        <media:keywords>roku tv, roku, tcl, hisense, ces2014, ces 2014, roku lt, ruku 1, streaming, stream, media, tekzilla, roku remote, set top box, coard cutting</media:keywords>
      </media:content>
      <ddn:id>28582</ddn:id>
    </item>
  </channel>
</rss>

不会从传入的XML中反序列化整个media:content块. 我已经使用

The entire media:content block is not deserialized from the XML passed in. I've iterated over the entire element extensions block using

foreach (SyndicationElementExtension extension in item.ElementExtensions)

,但不在其中. 有什么办法可以告诉SyndicationFeed.Load()方法也为我解析此块:

but its not in there. Is there any way I can tell the SyndicationFeed.Load() method to also parse this block for me:

SyndicationFeed feed = SyndicationFeed.Load(xmlReader);

推荐答案

确定.找到您的数据.

尝试一下,其中data变量是您提供的字符串.

Try this, where the data variable is the string you've provided.

内部XElement.Value包含整个媒体块,因此您将需要对其进行查询并选择所需的任何元素.

The inner XElement.Value contains the entire media block, so you will then need to query it and select which-ever element you want.

Dump()方法是LinqPad提供的扩展方法,我可以在其中进行调试.

The Dump() method is an extension method available from LinqPad which is where I do my debugging.

var data = @"<?xml version=""1.0"" encoding=""utf-8""?>
<rss version=""2.0"" xmlns:itunes=""http://www.itunes.com/dtds/podcast-1.0.dtd""
    xmlns:content=""http://purl.org/rss/1.0/modules/content/""
    xmlns:creativeCommons=""http://backend.userland.com/creativeCommonsRssModule""
    xmlns:media=""http://search.yahoo.com/mrss/""
    xmlns:atom=""http://www.w3.org/2005/Atom""
    xmlns:ddn=""http://discoverydn.com/about"">
  <channel>
    <title>Revision3 Feed</title>
    <link>http://revision3.com/user/1564421</link>
    <description>Customized RSS Feed of all your favorite Revision3 shows.</description>
    <language>en-us</language>
    <itunes:explicit>no</itunes:explicit>
    <itunes:summary></itunes:summary>
    <itunes:subtitle></itunes:subtitle>
    <itunes:author>Revision3</itunes:author>
    <itunes:owner>
      <itunes:email>feedback@revision3.com</itunes:email>
      <itunes:name>Revision3</itunes:name>
    </itunes:owner>
    <itunes:image href=""http://revision3.com/forum/image.php?u=415677"" />
    <itunes:keywords />
    <image>
      <title>Revision3 Feed</title>
      <width>100</width>
      <height>100</height>
      <link>http://revision3.com/user/1564221</link>
      <url>http://revision3.com/forum/image.php?u=415677</url>
    </image>
    <atom:link rel=""self"" type=""application/rss+xml"" title=""Revision3 Feed"" href=""http://revision3.com/feed/user/0a7ehtg09b0ab0/"" />
    <item>
      <title>Tekzilla Bites - Toyota Announces New Zero-Emission Fuel Cell Vehicle For 2015!</title>
      <link>http://revision3.com/tekzillabites/toyota-fuel-cell</link>
      <description>
&lt;p&gt;This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota&apos;s announced specs, right from the CES show floor.
&lt;/p&gt;
      </description>
      <content:encoded>
&lt;p&gt;This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota&apos;s announced specs, right from the CES show floor.
&lt;/p&gt;
      </content:encoded>
      <author>feedback@revision3.com (Revision3)</author>
      <pubDate>Tue, 07 Jan 2014 07:00:00 GMT</pubDate>
      <itunes:image href=""http://revision3.com/forum/image.php?u=415677"" />
      <itunes:duration>154</itunes:duration>
      <itunes:explicit>no</itunes:explicit>
      <itunes:keywords>toyota, fuel cell vehicle, hydrogen electric, hydrogen electricity, fcv, fuel cell, water exhaust, electric car, ces 2014</itunes:keywords>
      <itunes:author>Revision3</itunes:author>
      <itunes:subtitle>
This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota's announced specs, 
      </itunes:subtitle>
      <guid isPermaLink=""false"">/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--hd720p30.h264.mp4</guid>
      <enclosure url=""http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--hd720p30.h264.mp4"" length=""27874999"" type=""video/mp4"" />
      <media:content duration=""154"" medium=""video"" fileSize=""27874999"" url=""http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--hd720p30.h264.mp4"" type=""video/mp4"">
        <media:title>Tekzilla Bites - Toyota Announces New Zero-Emission Fuel Cell Vehicle For 2015!</media:title>
        <media:description>
&lt;p&gt;This year at their 2014 CES press conference, Toyota announced the Fuel Cell Vehicle (FCV): a hydrogen-powered vehicle whose only emission is water vapor going to market in 2015. Join Patrick for a look at the car, plus some of Toyota&apos;s announced specs, right from the CES show floor.
&lt;/p&gt;
        </media:description>
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--marge.thumb.jpg"" width=""640"" height=""360"" />
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--medium.thumb.jpg"" width=""300"" height=""169"" />
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0025/tekzilla--tekzillabites--0025--toyota-fuel-cell--mini.thumb.jpg"" width=""100"" height=""100"" />
        <media:player url=""http://revision3.com/tekzillabites/toyota-fuel-cell"" />
        <media:rating>nonadult</media:rating>
        <media:keywords>toyota, fuel cell vehicle, hydrogen electric, hydrogen electricity, fcv, fuel cell, water exhaust, electric car, ces 2014</media:keywords>
      </media:content>
      <ddn:id>28583</ddn:id>
    </item>
    <item>
      <title>Film Riot - Mondays: Getting Recognized, Poster Credits &amp; Royalty Free Music!</title>
      <link>http://revision3.com/filmriot/poster-credits</link>
      <description>
Ryan opens up the mail sack and answers some questions!
      </description>
      <content:encoded>
Ryan opens up the mail sack and answers some questions!
      </content:encoded>
      <author>feedback@revision3.com (Revision3)</author>
      <pubDate>Tue, 07 Jan 2014 05:00:00 GMT</pubDate>
      <itunes:image href=""http://revision3.com/forum/image.php?u=415677"" />
      <itunes:duration>522</itunes:duration>
      <itunes:explicit>no</itunes:explicit>
      <itunes:keywords>getting recognized, getting yourself out there, poster credits, royalty free music, music, getting permission to use music, film riot, mail sack, questions, answers, q&amp;a, ryan connolly</itunes:keywords>
      <itunes:author>Revision3</itunes:author>
      <itunes:subtitle>
Ryan opens up the mail sack and answers some questions!
      </itunes:subtitle>
      <guid isPermaLink=""false"">/filmriot/0364/filmriot--0364--poster-credits--hd720p30.h264.mp4</guid>
      <enclosure url=""http://videos.revision3.com/revision3/web/filmriot/0364/filmriot--0364--poster-credits--hd720p30.h264.mp4"" length=""73676325"" type=""video/mp4"" />
      <media:content duration=""522"" medium=""video"" fileSize=""73676325"" url=""http://videos.revision3.com/revision3/web/filmriot/0364/filmriot--0364--poster-credits--hd720p30.h264.mp4"" type=""video/mp4"">
        <media:title>Film Riot - Mondays: Getting Recognized, Poster Credits &amp; Royalty Free Music!</media:title>
        <media:description>
Ryan opens up the mail sack and answers some questions!
        </media:description>
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/filmriot/0364/filmriot--0364--poster-credits--marge.thumb.jpg"" width=""640"" height=""360"" />
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/filmriot/0364/filmriot--0364--poster-credits--medium.thumb.jpg"" width=""300"" height=""169"" />
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/filmriot/0364/filmriot--0364--poster-credits--mini.thumb.jpg"" width=""100"" height=""100"" />
        <media:player url=""http://revision3.com/filmriot/poster-credits"" />
        <media:rating>nonadult</media:rating>
        <media:keywords>getting recognized, getting yourself out there, poster credits, royalty free music, music, getting permission to use music, film riot, mail sack, questions, answers, q&amp;a, ryan connolly</media:keywords>
      </media:content>
      <ddn:id>28579</ddn:id>
    </item>
    <item>
      <title>Tekzilla Bites - Roku&apos;s Smart TV, More Channels, No Box- CES 2014</title>
      <link>http://revision3.com/tekzillabites/roku-tv-ces-2014</link>
      <description>
&lt;p&gt;Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton has the details. &lt;/p&gt;
      </description>
      <content:encoded>
&lt;p&gt;Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton has the details. &lt;/p&gt;
      </content:encoded>
      <author>feedback@revision3.com (Revision3)</author>
      <pubDate>Tue, 07 Jan 2014 05:00:00 GMT</pubDate>
      <itunes:image href=""http://revision3.com/forum/image.php?u=415677"" />
      <itunes:duration>105</itunes:duration>
      <itunes:explicit>no</itunes:explicit>
      <itunes:keywords>roku tv, roku, tcl, hisense, ces2014, ces 2014, roku lt, ruku 1, streaming, stream, media, tekzilla, roku remote, set top box, coard cutting</itunes:keywords>
      <itunes:author>Revision3</itunes:author>
      <itunes:subtitle>
Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton 
      </itunes:subtitle>
      <guid isPermaLink=""false"">/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--hd720p30.h264.mp4</guid>
      <enclosure url=""http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--hd720p30.h264.mp4"" length=""21262105"" type=""video/mp4"" />
      <media:content duration=""105"" medium=""video"" fileSize=""21262105"" url=""http://videos.revision3.com/revision3/web/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--hd720p30.h264.mp4"" type=""video/mp4"">
        <media:title>Tekzilla Bites - Roku&apos;s Smart TV, More Channels, No Box- CES 2014</media:title>
        <media:description>
&lt;p&gt;Roku known for their ever popular line up of stand-alone media streaming devices, shook things up at CES 2014 this year. Enter: Roku TV, a TV with the Roku platform baked in and a few new extras that will surprise even veteran Roku users. Patrick Norton has the details. &lt;/p&gt;
        </media:description>
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--marge.thumb.jpg"" width=""640"" height=""360"" />
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--medium.thumb.jpg"" width=""300"" height=""169"" />
        <media:thumbnail url=""http://videos.revision3.com/revision3/images/shows/tekzilla/tekzillabites/0024/tekzilla--tekzillabites--0024--roku-tv-ces-2014--mini.thumb.jpg"" width=""100"" height=""100"" />
        <media:player url=""http://revision3.com/tekzillabites/roku-tv-ces-2014"" />
        <media:rating>nonadult</media:rating>
        <media:keywords>roku tv, roku, tcl, hisense, ces2014, ces 2014, roku lt, ruku 1, streaming, stream, media, tekzilla, roku remote, set top box, coard cutting</media:keywords>
      </media:content>
      <ddn:id>28582</ddn:id>
    </item>
  </channel>
</rss>";

var rss = new Rss20FeedFormatter();
rss.ReadFrom(XmlReader.Create(new StringReader(data)));

var elements = rss.Feed.Items.SelectMany(s => s.ElementExtensions.Select(x => x.GetObject<XElement>().Value));
elements.Dump();

可以在此处找到可能回答您问题的另一个SO答案:

Another SO answer which might answer your question can be found here: Reading non-standard elements in a SyndicationItem with SyndicationFeed.

干杯,亚伦

这篇关于使用SyndicationFeed从RSS获取媒体元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆