reddit top

Last week I published the Hacker Top program and promised to explain how it was made. Before I do that, let me publish another similar program for Reddit. It's the Reddit Top program.

As I mentioned in the Hacker Top post, Reddit is my favorite source for news because of the great programmer community it has. I actually unsubscribed from all the default subreddits (politics, pics, etc.) and subscribed to some 20 - 30 programming subreddits (like python, erlang, compsci and many others).

Reddit Top was actually derived from Hacker Top. Hacker Top was made in such a manner that it required me just to write a new parser for Reddit to create the new program. The program is written in Python programming language and uses ncurses interface for displaying the stories.

reddit top, follow reddit from console/shell
Try the 'm' keyboard shortcut to switch to other display modes


Download link: reddit top program
Downloaded: 6857 times

I'll describe the process of creating the program in one of the next posts.
If you want to read about that, I suggest you subscribe to my rss feed.

Note - this program is released under GNU GPL.

How to run the program?

1) Make sure you are running a Unix type operating system.

2) Make sure you have Python installed. Any recent version will do.

3) Download and unpack the hacker top program archive.

$ wget ''
$ tar -xvzf reddit-top.tgz

4) Change to 'reddit-top' directory which was created by unpacking the archive.

$ cd reddit-top

5) Give the '' program execute permissions.

$ chmod u+x

6) Run the program.

$ ./

(If that does not work out, try running 'python ./')

Make sure that your terminal is at least 80 columns wide, otherwise the program won't be able to display the results nicely.

Command Line Options

If you run the program with '--help' argument, it will display the possible command line options:

Usage: ./ [-h|--help] - displays this
Usage: ./ [-s|--subreddit subreddit]
          [-i|--interval interval] [-n|--new]
          [-u|--utf8 <on|off>]

As the help message suggests, the four main options are:

  • -s or --subreddit, which specifies the subreddit to monitor.

    The default is reddit's front page (

    At the moment it is not possible to specify multiple subreddits. I'll add the feature in the future. Here are a few examples of valid subreddits - 'programming', 'wtf', 'python', 'politics', and others.
  • -i or --interval, which specifies refresh interval.

    The default refresh interval is 1 minutes. Here are a few examples: 10s (10 seconds), 12m (12 minutes), 2h (2 hours).
  • -u or --utf8, turns on utf8 output mode.

    Default: off. Use this if you know for sure that your terminal supports it, otherwise you might get gibberish.
  • -n or --new, which follows only the newest reddit stories on a given subreddit or front page.

    Default: follow front page stories.

Keyboard Shortcuts

There are several keyboard shortcuts which you should know about when using the Reddit Top program:

  • q - quits the program.
  • u - forces an update of the news.
  • up arrow/down arrow (or alternatively j/k keys) - scrolls the news list up or down.
  • m - changes the display mode. There are 5 different display modes for your taste.

Enjoy the program! I'll write some details how I created it in one of the next posts. Stay tuned - subscribe to my rss feed!

Download Reddit Top Program

Download link: reddit top program
Downloaded: 6857 times

The program is released under GNU General Public License.


Chris Brannon Permalink
July 15, 2008, 00:18

This looks interesting.
At the moment, I view reddit using Gnus under Emacs. Gnus has the nnrss
backend for reading RSS feeds.

Meemo Garza Permalink
July 15, 2008, 02:36

How about enabling a method to pass the links to an external application.

July 15, 2008, 05:33

Works like gold on Debian Stable. :-) But yeah, adding a way to click on news-item would be great! :)

Zack Permalink
July 15, 2008, 15:48

Maybe have it open in links or lynx?

July 15, 2008, 17:48

This is really cool!
Now we just need the equivalent for Twitter...

July 18, 2008, 16:22

Geeky :)

July 18, 2008, 23:45

How about if reddit produced a popup java console version for viewing their site in a more work-friendly way?

awh Permalink
July 29, 2008, 04:11

Hey, nice script! I have one concern, though. When looking at "", I noticed that you set the user-agent as this:

request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)')

First, I don't really see the use in this, why would it matter to reddit what your user-agent is? Second, I find that it's much more honest to use a useful user-agent. It lets a website/server owner contact you if they are having huge problems with your app, and there might be a design flaw.

Just thought I'd give a heads up!

patrick jury Permalink
November 18, 2012, 15:57

The reddit api requires you to specify a user-agent to build the client object.

July 31, 2009, 08:56

Looks great. However, on invocation, I get the following error:

Reddit might have redesigned:
lengths of score, title, tagline and comment lists do not match

December 24, 2009, 02:59

It's should Installing simplejson package.

December 24, 2009, 03:06

Maybe should open it in links or lynx?

Leave a new comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cdrom_71": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.