Reddit comment/submission vote tracker
31/01/2010Some time ago I noticed that the up/down count on comments & submissions on reddit would vary wildly under the hood whilst the aggregate displayed would stay fairly steady quite often. By that I mean a comment that had 20 points might be flicking wildy as redditors turn arrows blue & orange.
I thought it might be interesting to graph such activity and I had at first thought of using google charts’ fairly decent api but quickly discovered Flot and was completely sold. If you have ever needed to create some small chart in a web app and started to roll your own solution (very often people will do some graph drawing server side then send over an image) then stop! and go look at Flot. Its an amazing bit of javascript.
In hindsight the “battle of your comment” isn’t as interesting as I thought it would be but it is quite nice to watch how a submission progresses on the site over time. Its only really useful for semi-popular ones as otherwise there just isn’t the data. The whole thing works by appending .json to the reddit url given. That’s the unoffical/offical reddit API. That is then parsed to grab the up/down vote count and then its simply sent back to Flot as JSON itself.
I have noticed that whilst the comment count on the site will vary much more rapidly the JSON file itself doesn’t and seems to lag behind somewhat. I guess that makes sense from a load/abuse point of view. In real terms this means there’s not a lot of point setting the timeout on this page to hammer reddit for “by the second” data.
Some may find it useful so here it is. I have it currently sitting at jaymzcd.webfactional.com. This makes use of cherrypy and jquery. If you’d like the code its here.
