我尝试用这个例子来从中获取图像的URL http://www.nydailynews.com/cmlink/NYDN.Article.rss
但没有成功
ü可以帮助我找到正确的方式通过,以获得从RSS源项目的所有可能的图像的URL SyndicationItem
类?
有解决办法草案在这里 ,但我想应该更通用的解决方案。
谢谢!
List<RssFeedItem> rssItems = new List<RssFeedItem>();
Stream stream = e.Result;
XmlReader response = XmlReader.Create(stream);
SyndicationFeed feeds = SyndicationFeed.Load(response);
foreach (SyndicationItem f in feeds.Items)
{
RssFeedItem rssItem = new RssFeedItem();
rssItem.Description = f.Summary.Text;
foreach (SyndicationLink enclosure in f.Links.Where<SyndicationLink>(x => x.RelationshipType == "enclosure"))
{
Uri url = enclosure.Uri;
long length = enclosure.Length;
string mediaType = enclosure.MediaType;
rssItem.ImageLinks.Add(url.AbsolutePath);
}
}