C# - 如何从rss feed获取全文内容?

时间:2017-09-15 15:57:27

标签: c# asp.net text rss feed

我想要来自rss Feed的完整内容,而不仅仅是描述。 这就是我所拥有的:

        string RssFeedUrl = "http://g1.globo.com/dynamo/rss2.xml";
        List<feed> feeds = new List<feed>();
        try
        {
            XDocument xDoc = new XDocument();
            xDoc = XDocument.Load(RssFeedUrl);
            var items = (from x in xDoc.Descendants("item")
                         select new
                         {
                             title = x.Element("title").Value,
                             link = x.Element("link").Value,
                             pubDate = x.Element("pubDate").Value,
                             description = x.Element("description").Value
                         });
            if (items != null)
            {
                foreach (var i in items)
                {
                    feed f = new feed
                    {
                        Titulo = i.title,
                        Link = i.link,
                        DataPublicada = i.pubDate,
                        Descricao = i.description
                    };

                    feeds.Add(f);
                }
            }

            gvRss.DataSource = feeds;
            gvRss.DataBind();
        }
        catch (Exception ex)
        {
            throw;
        }

这只是给我一个简短的摘录,但我想要完整的内容文字。

0 个答案:

没有答案