-
-
Save mjard/4618133 to your computer and use it in GitHub Desktop.
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 requests | |
import time | |
def getReddit(subreddit): | |
request = requests.get("http://reddit.com/r/%s/.json" % subreddit) | |
return request.json()['data']['children'] | |
seen_ids = set() | |
while True: | |
for post in getReddit('all'): | |
data = post['data'] | |
if not data['id'] in seen_ids: | |
seen_ids.add(data['id']) | |
print '>>', data['title'] | |
time.sleep(15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment