Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.

License

NotificationsYou must be signed in to change notification settings

arminreiter/FeedReader

Repository files navigation

FeedReader is a .net library used for reading and parsing RSS and ATOM feeds. SupportsRSS 0.91, 0.92, 1.0, 2.0 and ATOM.Developed because tested existing libraries do not work with different languages, encodings or have other issues.Library tested with multiple languages, encodings and feeds.

FeedReader library is available as NuGet package:https://www.nuget.org/packages/CodeHollow.FeedReader/

Usage

The simplest way to read a feed and show the information is:

varfeed=awaitFeedReader.ReadAsync("https://arminreiter.com/feed");Console.WriteLine("Feed Title: "+feed.Title);Console.WriteLine("Feed Description: "+feed.Description);Console.WriteLine("Feed Image: "+feed.ImageUrl);// ...foreach(variteminfeed.Items){Console.WriteLine(item.Title+" - "+item.Link);}

There are some properties that are only available in e.g. RSS 2.0. If you want to get those properties, the property "SpecificFeed" is the right one:

varfeed=awaitFeedReader.ReadAsync("https://arminreiter.com/feed");Console.WriteLine("Feed Title: "+feed.Title);if(feed.Type==FeedType.Rss_2_0){varrss20feed=(Feeds.Rss20Feed)feed.SpecificFeed;Console.WriteLine("Generator: "+rss20feed.Generator);}

If the url to the feed is not known, then you can use FeedReader.GetFeedUrlsFromUrl(url) to parse the url from the html webpage:

stringurl="arminreiter.com";varurls=FeedReader.GetFeedUrlsFromUrl(url);stringfeedUrl;if(urls.Count()<1)// no url - probably the url is already the right feed urlfeedUrl=url;elseif(urls.Count()==1)feedUrl=urls.First().Url;elseif(urls.Count()==2)// if 2 urls, then its usually a feed and a comments feed, so take the first per defaultfeedUrl=urls.First().Url;else{// show all urls and let the user select (or take the first or ...)// ...}varreaderTask=FeedReader.ReadAsync(feedUrl);readerTask.ConfigureAwait(false);foreach(variteminreaderTask.Result.Items){Console.WriteLine(item.Title+" - "+item.Link);// ...}

The code contains a sample console application:https://github.com/codehollow/FeedReader/tree/master/FeedReader.ConsoleSample

Specifications

About

C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp