This nuget package will help you to get Feed contents from an URL. It supports RSS and Atom Feeds.
##Installation
To install Feed-Aggregator, run the following command in the Package Manager Console
PM> Install-Package FeedAggregator
##Quick Start
It is recommended that you install FeedAggregator via NuGet.Or Add a reference to the FeedAggregator.dll
You can check a given url contains a valid feed
bool isValidFeed = SyndicationFeed.IsValidFeed(FeedUrl);
If a url has valid feed, you can follow the steps
- Load The Feed From Url.
SyndicationFeed syndicationFeed = SyndicationFeed.Load(FeedUrl);
- You can get the FeedType from the SyndicationFeed. And You can type cast the Feed property to RSSFeed or AtomFeed or MediaRSSFeed or YouTubeFeed object according to the type
FeedType type = syndicationFeed.FeedType;
if(type == FeedType.RSS)
{
RSSFeed rss = (RSSFeed)syndicationFeed.Feed;
}
Or you can simply use it as IFeed which has Properties that are common to all feed types
IFeed feed = syndicationFeed.Feed;
var imageUrl = feed.ImageUrl;
var url = feed.Url;
var title = feed.Title;
var description = feed.Descriptions;
- You can get the feed items also. The feed item will contain the common properties of various kind of feed items.
foreach(IFeedItem item in feed.Items)
{
var imageUrl = item.ImageUrl;
var url = item.Url;
var title = item.Title;
var description = item.Descriptions;
}