How to read a image url from a rss with syndicationFeed?

后端 未结 3 1573
借酒劲吻你
借酒劲吻你 2021-02-06 14:30

How to get the image url? supposing that the tag is

    

        
3条回答
  •  遇见更好的自我
    2021-02-06 15:10

    Stream stream = e.Result;

            XmlReader response = XmlReader.Create(stream);
    
            SyndicationFeed feeds = SyndicationFeed.Load(response);
    
            foreach (SyndicationItem item in feeds.Items)
            {
                if (item.ElementExtensions.Where(p => p.OuterName == "thumbnail").Count() != 0)
                {
                    string imgPath = item.ElementExtensions.Where(p => p.OuterName == "thumbnail").First().GetObject().Attribute("url").Value;
                    MessageBox.Show(imgPath); //use it to show the img in DIV or whereever you wish.
                }
    
            }
    

提交回复
热议问题