Skip to content

Instantly share code, notes, and snippets.

@anderser
Last active December 18, 2015 19:49
Show Gist options
  • Save anderser/5836099 to your computer and use it in GitHub Desktop.
Save anderser/5836099 to your computer and use it in GitHub Desktop.
Retrieve video urls from Instagram API using instagram python client. Has to use the raw json response since the python client does not yet support video.
api = client.InstagramAPI(client_id=CONFIG['client_id'], client_secret=CONFIG['client_secret'])
instagen, pages = api.tag_recent_media(30, 0, "thetag", max_pages=1, return_json=True)
videos = []
for item in instagen:
if "videos" in item:
videos.append(
{'user': item['user']['username'],
'videourl': item['videos']['standard_resolution']
}
)
videos_json = json.dumps(videos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment