Skip to content

Instantly share code, notes, and snippets.

@foresmac
Created November 9, 2015 16:27
Show Gist options
  • Save foresmac/0771ac2722bc0445c4c5 to your computer and use it in GitHub Desktop.
Save foresmac/0771ac2722bc0445c4c5 to your computer and use it in GitHub Desktop.
import json
import urllib.request
hashtag = '' # Choose any hashtag
ACCESS_TOKEN = '' # Get a token from https://instagram.com/developer
start_url_string = 'https://api.instagram.com/v1/tags/{0}/media/recent?access_token={1}'
start_url = start_url_string.format(hashtag, ACCESS_TOKEN)
response = urllib.request.urlopen(start_url)
raw_data = response.read()
data = json.loads(raw_data)
pics = data['data']
urls = [pic['images']['standard_resolution']['url'] for pic in pics]
print urls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment