Using a Google Reader as a lifestream archive

After I set up my lifestream to track a host of custom actions (like comments on other blogs, or votes on FSD) I discovered that many of the feeds I was using were having a item limit (from 10 to 20). That meant that if I made, say, 11 or more comments in various other blogs, the older ones would dissapear from the list, even if the date was still in the limit I’ve set. Only the newer 10 would always be shown and it would seem as If I made no comments below that date.

It was not a bigg issue but I really wanted it to work right so as to get a more accurate overall idea of where I am spending my time (graphs and so).

I remembered then, that Google Reader seems to always have the option to go back into older posts in the feed, up to the time that you made the subscription through it. This meant that it archives everything in that feed and stores it in its own server (Damn that Google storage is endless). Also, Google Reader has the option to put various subscriptions under a specific folder/tag, allowing you to read all the subscriptions together.

It also allows you to make that tag public. A Public tag allows anyone to see the feeds that you share through it but also gives you a feed to subscribe in turn. This feed, unlike the original ones, can provide feeds data as far back as the time you made the Google Reader subscription (and even further if someone else had subscribed to it before you, I believe). All I needed to to is append ?n=# at the end of my google reader feed where # is the number of items I want to see each time the feed is polled. (I selected 100)

So there I had it. An easy way to make an arvhive of my tracked activities without setting up my own database.

The only problem now was to make the lifestream plugin recognise from which feed in turn each item comes and then assign it the correct class. This was a more challenging question as my previous method to compare the original feed with the current item’s could not work. I discovered that I could filter by the items target link but since I wanted to use the same service to track different activites, it would always filter them the same way. In case you’re wondering, I use Getboo to bookmark pages that I commented on as well as FSD articles I’ve voted up, down or commented (Since, unfortunately, FSD does not provide such feeds by itself until now). The number of things I track through Getboo will only increase as I find more actions that don’t provide feeds.

Thus I needed some way to the original feed through my Google Reader lifestream feed.

Well, how very fortunate of me that Google Reader publishes an Atom feed and not only that but it includes the source of the original feed for your convenience. 😀

A little trial & error with the (truly excellent) SimplePie APIs, and I’d managed to find and write the code that I needed to use.

if ($feedurl == $greader_lifestream_feed) {
if ($source = $item->get_source()) {$source_url = $source->get_permalink();}
if (stripos($source_url, 'twitter') !== false) {
$class = 'twitter';
$tf_counter = $tf_counter+1;
$current_title = 'Status Update (Twitter)';
if (stripos($source_url, 'mycomments') !== false) {
$class = 'comments';
$extra_text = 'Commented on: ';
$getboo_comment_feed_counter = $getboo_comment_feed_counter+1;
$current_title = 'Comments Elsewhere';
if (stripos($source_url, 'fsd') !== false) {
$class = 'fsd';
$extra_text = 'Voted up: ';
$fsd_counter = $fsd_counter+1;
$current_title = 'Votes up on Free Software Daily Article';

And yes. I’m proud of my little code snippet. 😀

So now, if I have any feed with a sufficiently low item limit, all I need to do is subscribe to it through Google Reader and add the appropriate if statement in my plugin code and presto! Instant archiving. There is only a (very) slight problem in the sense that the lifestream update is delayed by the time it takes for google reader to refresh the original feed and then update the public tag.

All I need to do now is figure out a way to separate items in the google reader feed through the category tags that getboo provides. That would be sweet as it would cut down on line number but unfortunately the get_category() simplepie function does not seem to work as intended for me 🙁

5 thoughts on “Using a Google Reader as a lifestream archive”

  1. SimplePie is much much, more powerful and it includes caching as well for speed. For example, I don’t know how much you did except putting a google reader feed but in simplepie I have at the moment 10 feeds merged, from various sources, at chronological order, with the occasional feed further modified to filter based on author fields or urls.

  2. Since this was posted about a year ago, does this do anything that FriendFeed doesn't NOW do?

Comments are closed.