Created
November 29, 2012 21:28
-
-
Save Pringley/4172029 to your computer and use it in GitHub Desktop.
Reddit Maitred Applicance
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
import reddit | |
# Connect to Reddit API. | |
r = reddit.Reddit(user_agent='maitred-reddit') | |
while True: | |
# Get request from user. | |
words = raw_input().split() | |
subreddit = words[1] | |
amount = int(words[2]) if len(words) >= 3 else 5 | |
# Print results from the specified subreddit. | |
results = r.get_subreddit(subreddit).get_hot(limit=amount) | |
for result in results: | |
print(str(result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment