views:

192

answers:

5

This could be weird, Have you ever come across a blog which you wanted to read in the chronological order? And that blog could be old, with several hundred posts. When i add this feed to my feed reader, say googlereader, the latest feed comes on top and as i scroll down further, the older posts appear. This could be frustrating if you want to read it from the beginning. Is there any reader that does this? Or, i would love to do this as a pet project, (preferably in c#), how exactly should i go about it? Also, are there any .NET libraries which i can use to work on RSS feeds? I have not done any RSS feed programming before.

EDIT I would like to know if there are any technical limitations to this. This was jsut one interesting problem that I encountered that i thought could be tackled programmatically.

+3  A: 

In Google Reader, when you're reading a feed, there is a "Feed settings..." menu with the options: "Sort by newest", "Sort by oldest".

Folders have the same options under the menu "Folder settings..."

No programming required.

Forgotten Semicolon
Sort by oldest only shows items from the last 30 days. Not of much help
ashwnacharya
You're going to be limited by what the feed actually kicks out. Not all feeds show all historical posts. In fact, that would be a terrible idea.
Forgotten Semicolon
+2  A: 

I think you might have trouble with this. Many RSS feeds only keep the latest 10 or so posts, so there would be no way to provide the older data from the feed since the blog started.

y0mbo
Google Reader would fetch me all the posts if i waited long enough. My only problem is with the order in which it fetches.
ashwnacharya
Google reader cannot fetch all the posts if an RSS feed does not provide them. The standard used to be only 10 items in an RSS feed, I don't know if anyone follows that anymore or not, though.
y0mbo
A: 

This should be fairly easy with any language...all you would need to do is read the feed xml into a DOM structure (nearly all languauges including C# have a DomDocument class)

You should then be able to simply loop through the item nodes in reverse order...

see: http://msdn.microsoft.com/en-us/library/ms756177(VS.85).aspx

As other said, depending on the rss feed, you may only get a finite amount of items.

mmattax
+1  A: 

In Google Reader, you can have it display the items in a folder (feed) from either Newest to Oldest, or Oldest to Newest. To do this, select the feed, select the "Feed settings" drop down, and select "Sort by oldest". I'm not sure how far back Google Reader goes, but possibly all the way since it first started monitoring the feed.

Andy
Nope.. Only posts from last 30 days
ashwnacharya
Ah - I didn't know that. Google Reader would give him some history at least. Not sure what other options there are then, really.
Andy
+1  A: 

If you do decide to roll your own C# application to do this, it is very straightforward in the current version of the .NET Framework.

Look for the System.ServiceModel.Syndication namespace. That has classes related to RSS and Atom feeds. I wrote some code recently that generates a feed from a database using these classes, and adds geocodes to the feed items. I had the same problem where i needed to reverse the order of the items in the feed, because my database query returned them in the opposite order I wanted my users to see.

What I did was to simply hold the list of SyndicationItem objects for the feed in my own List<SyndicationItem> data structure until right before I want to write the feed to disk. Then I would do something like this:

private SyndicationFeed m_feed;
private List<SyndicationItem> m_items;

...snip...

m_items.Reverse();
m_feed.Items = m_items;
Tim Farley