Exemple #1
0
        public static void ParseSyndicationItem(this RssItem item, SyndicationFeed syndicFeed, SyndicationItem syndicItem)
        {
            item.Title   = syndicItem.Title.Text;
            item.PubDate = syndicItem.PublishedDate.DateTime;
            item.Author  = syndicItem.Authors.Count > 0 ? syndicItem.Authors[0].Name.ToString() : "";
            if (syndicItem.Id.StartsWith("http"))
            {
                item.Link = syndicItem.Id;
            }
            else if (syndicItem.Links.Count > 0)
            {
                item.Link = syndicItem.Links[0].Uri.OriginalString;
            }

            item.ParseImage(syndicItem.NodeValue);

            if (syndicFeed.SourceFormat == SyndicationFormat.Atom10)
            {
                item.Content = HtmlUtilities.ConvertToText(syndicItem.Content.Text);
            }
            else if (syndicFeed.SourceFormat == SyndicationFormat.Rss20)
            {
                item.Content = HtmlUtilities.ConvertToText(syndicItem.Summary.Text);
            }
        }