Reputation: 25
I’m very new to programming with RSS feeds to please forgive me if this sounds like a really general question.
Is it possible to take multiple RSS feeds from multiple sites and combine them as a single object to show to the end user?
For example, could I take the latest news headlines from one site, the latest blog updates from a totally different site and combine them into a single list to show the user?
I have seen this sort of question asked before and it seems like its possible, but the slight twist is I want to let the user add any feed that they want from any source
I’m looking to do this in ASP.NET
Many thanks!
Upvotes: 2
Views: 1566
Reputation: 887479
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 should add error handling in case one of the feeds is unavailable or invalid.
Upvotes: 3
Reputation: 245429
It is possible, yes.
For a good example of this kind of thing in action, check out Yahoo! Pipes.
This would probably be a good application of LINQ to XML, but I'll leave the implementation up to you.
Upvotes: 1