Looks like the web is all about writing feed but not about reading one.
So here it is.
private void button1_Click(object sender, EventArgs e)
{
string url = @"http://feeds.feedburner.com/cenedella?format=xml";
SyndicationResourceLoadSettings settings = new SyndicationResourceLoadSettings();
RssFeed feed = RssFeed.Create(new Uri(url), settings);
foreach(var i in feed.Channel.Items) {
var title = i.Title;
var date = i.PublicationDate;
var content = GetBlogPostContent(i, true);
}
}
private string GetBlogPostContent(RssItem i, bool removeHtml){
string content = null;
foreach(ISyndicationExtension s in i.Extensions) {
if(s is SiteSummaryContentSyndicationExtension){
SiteSummaryContentSyndicationExtension ss = s as SiteSummaryContentSyndicationExtension;
var t = ss.Context.Encoded;
content = System.Web.HttpUtility.HtmlDecode(t);
if(removeHtml)
content = Regex.Replace(content, "<[^>]*>", "", RegexOptions.Compiled);
}
}
return content;
}
This comment has been removed by the author.
ReplyDeleteThis is good code, but something isn't panning out. I'm trying to parse feeds.feedburner.com/failblog which clearly has the correct node
ReplyDelete[content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"]
but item.Extensions.Count() returns 0.
Note: carats replaced with brackets so the code didn't get stripped out of the comment.
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Node JS Online Training from India .
ReplyDeleteThis is very interesting Thank you for sharing your Post. I really enjoy everything on this blog. Acronis True Image 2022 Crack
ReplyDeleteWindows Movie Maker 2022 Crack
Microsoft Office 2022 Crack
Adobe Photoshop 2022 Crack