Skip to content

Instantly share code, notes, and snippets.

@davidar
Created November 8, 2016 09:32
Show Gist options
  • Save davidar/f77c96ac81ed751655f271a47c9df78f to your computer and use it in GitHub Desktop.
Save davidar/f77c96ac81ed751655f271a47c9df78f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import requests
d = requests.get('https://www.reddit.com/r/EarthPorn/top/.json', headers={'User-agent':'IOTD bot'}).json()
for c in d['data']['children']:
src = c['data']['preview']['images'][0]['source']
if src['width'] >= 4000:
print 'Location: ' + src['url'] + '\n'
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment