Skip to content

Instantly share code, notes, and snippets.

@neurobashing
Created February 15, 2012 21:56
Show Gist options
  • Save neurobashing/1839265 to your computer and use it in GitHub Desktop.
Save neurobashing/1839265 to your computer and use it in GitHub Desktop.
My command line reddit reader
#!/usr/bin/env python
import urllib,json
a = urllib.urlopen('http://www.reddit.com/r/programming/.json')
try:
j = json.load(a)['data']
except KeyError:
print "Reddit sucks."
exit()
storieslist = j['children']
for x in storieslist:
title = x['data']['title']
URL = x['data']['url']
print title.encode("utf-8", "ignore"), '\t', URL.encode("utf-8", "ignore")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment