Skip to content

Instantly share code, notes, and snippets.

@andycandrea
Created February 28, 2014 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andycandrea/9280192 to your computer and use it in GitHub Desktop.
Save andycandrea/9280192 to your computer and use it in GitHub Desktop.
Get the most recent stories on HackerNews
import sys
from hn import HN
hn = HN()
print "Enter number of stories you'd like to view: "
n = raw_input()
while not n.isdigit():
print "Enter an integer: "
n = raw_input()
n = int(n)
for story in list(hn.get_stories(story_type="newest", limit=n))[:n]:
print(story.rank, story.title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment