Combine multiple rss feeds

I'm very new to programming with RSS feeds, so forgive me if this sounds like a really common question.

Is it possible to take multiple RSS feeds from multiple sites and combine them as one object to show to the end user?

For example, can I take the latest news headlines from one site, the latest blog updates from a completely different site and combine them into one list to show the user?

I've seen a question like this asked before and it seems possible, but a little twist - I want the user to add any feed they want from any source.

I need to do this in ASP.NET

Many thanks!

+2


source to share


2 answers


You can use the SyndicationFeed

class
to work with RSS feeds in .Net.

You probably want to do something like this (untested):



var allItems = new List<SyndicationItem>();

foreach(var feedUrl in whatever) { //In your list of urls
    using(var reader = XmlReader.Create(url))
        allItems.AddRange(SyndicationFeed.Load(reader).Items);
}

var newFeed = new SyndicationFeed(items);

//Do something with newFeed

      

You must add error handling if one of the channels is unavailable or invalid.

+3


source


Probably yes.

For a good example of this in action, check out Yahoo! Pipes .



This is probably going to be a good LINQ to XML application, but I'll leave the implementation up to you.

+1


source







All Articles