API Examples

instaLooter also provides an API that can be used to extend the capabilities of instaLooter, to fit your needs more tightly or to integrate instaLooter to your program.

Download pictures

Download 50 posts from the Dream Wife band account to the Pictures directory in your home folder (you better be checking their music though):

from instalooter.looters import ProfileLooter
looter = ProfileLooter("dreamwifetheband")
looter.download('~/Pictures', media_count=50)

Users from comments

Obtain a subset of users that commented on some of the posts of Franz Ferdinand.

from instalooter.looters import ProfileLooter
looter = ProfileLooter("franz_ferdinand")

users = set()
for media in looter.medias():
   info = looter.get_post_info(media['shortcode'])
   for comment in post_info['edge_media_to_comment']['edges']:
       user = comment['node']['owner']['username']
       users.add(user)

Users from mentions

from instalooter.looters import ProfileLooter
looter = ProfileLooter("mandodiaomusic")

users = set()
for media in looter.medias():
   info = looter.get_post_info(media['shortcode'])
   for comment in post_info['edge_media_to_tagged_user']['edges']:
       user = comment['node']['user']['username']
       users.add(user)

Download resized pictures

Unfortunately, this is not possible anymore as Instagram added a hash signature to prevent messing with their URLs.