Created
February 15, 2012 21:56
-
-
Save neurobashing/1839265 to your computer and use it in GitHub Desktop.
My command line reddit reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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