Skip to content

Instantly share code, notes, and snippets.

@eltonvs
Created November 29, 2015 02:27
Show Gist options
  • Save eltonvs/a9a2baf0b09fc6eed23f to your computer and use it in GitHub Desktop.
Save eltonvs/a9a2baf0b09fc6eed23f to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from instagram.client import InstagramAPI
def connect_api(token):
return InstagramAPI(access_token=token)
def show_recent_profiles_liked(api):
recent_likes, next_ = api.user_liked_media(count=10)
names = [likes.user.full_name for likes in recent_likes]
names = list(set(names))
names.sort()
for name in names:
print name
def show_followers(api, user_id):
followers, next_ = api.user_followed_by(user_id=user_id)
for follower in followers:
print follower.full_name
def show_follows(api, user_id):
followers, next_ = api.user_follows(user_id=user_id)
for follower in followers:
print follower.full_name
def show_profile_info(api, user_id):
info = api.user(user_id=user_id)
print info.counts
def show_recent_posts(api, user_id):
recent_media, next_ = api.user_recent_media(user_id=user_id, count=10)
for media in recent_media:
print media.caption
token = "YOUR_TOKEN_HERE"
user_id = "YOUR_USER_ID_HERE"
api = connect_api(token)
# Examples
show_recent_profiles_liked(api)
show_follows(api, user_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment