Skip to content

Instantly share code, notes, and snippets.

@mjard
Forked from desg/whyyyyyyyyyyyyyyyyyyy.py
Last active December 11, 2015 14:59
Show Gist options
  • Save mjard/4618133 to your computer and use it in GitHub Desktop.
Save mjard/4618133 to your computer and use it in GitHub Desktop.
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