示例#1
0
        private RssFeedItem ParseAtomEntry(string origin, XmlNode node)
        {
            if (!node.HasChildNodes)
            {
                return(null);
            }

            RssFeedItem ret = new RssFeedItem();

            var title   = node["title"];
            var content = node["content"];

            if (title == null && content == null)
            {
                return(null);
            }

            ret.Origin          = origin;
            ret.Title           = title?.InnerText ?? "";
            ret.Description     = content?.InnerText ?? "";
            ret.Link            = node["link"]?.GetAttribute("href") ?? "";
            ret.PublicationDate = ParseISO8601String(node["published"]?.InnerText ?? "");
            ret.Guid            = node["id"]?.InnerText ?? "";
            ret.EnclosureUrl    = ret.Link;

            return(ret);
        }
示例#2
0
        private RssFeedItem ParseRssItem(string origin, XmlNode node)
        {
            if (!node.HasChildNodes)
            {
                return(null);
            }

            RssFeedItem ret = new RssFeedItem();

            var title           = node["title"];
            var description     = node["description"];
            var richDescription = node["content:encoded"];

            if (title == null && description == null && richDescription == null)
            {
                return(null);
            }

            ret.Origin          = origin;
            ret.Title           = title?.InnerText ?? "";
            ret.Description     = richDescription?.InnerText ?? description?.InnerText ?? "";
            ret.Link            = node["link"]?.InnerText ?? "";
            ret.PublicationDate = ParseRssDate(node["pubDate"]?.InnerText ?? "");
            ret.Guid            = node["guid"]?.InnerText ?? "";
            ret.EnclosureUrl    = node["enclosure"]?.Attributes["url"]?.Value ?? "";

            return(ret);
        }