"Instagram" (Service Connection)

Connect your Instagram account to the Wolfram Language to import and analyze photos, comments, and followers.

Connecting & Authenticating

    ServiceConnect["Instagram"] creates a connection to the Instagram API. If a previously saved connection can be found, it will be used; otherwise, a new authentication request will be launched.

Requests

    ServiceExecute["Instagram","request",params] sends a request to the Instagram API, using parameters params. The following give possible requests.

    User Data

    Requests:

    "UserData" data about the authenticated user's account

    "UserID"  ▪  "Picture"

    Followers

    Requests:

    "Followers" usernames of the user's followers

    "FollowerIDs" user IDs of the user's followers

    "Followings" usernames of people the user is following

    "FollowingIDs" user IDs of people the user is following

    "FollowingCount"  ▪  "FollowerCount"

    User Media

    Requests:

    "LatestMedia" import the user's most recent published media

    "LatestPhotos" import a list of the user's most recent published photos

    "LatestVideos" link to the user's most recent videos

    "Liked" photos the user has liked

    "CaptionedLatestPhotos" import a list of the user's most recent published photos with captions

    Parameters:
  • "Elements""Data"data elements to return
    MaxItems20number of results to return
    "MediaResolution""Standard"media resolution
  • Requests:

    "LatestMediaIDs" import the user's most recent published media IDs

    "LikedIDs" IDs of photos the user has liked

    Parameters:
  • MaxItems20number of results to return
    "MediaResolution""Standard"media resolution
  • Media Data

    Requests:

    "Media" import a photo

    "Caption" caption of the post

    "CommentCount" number of comments

    "LikeCount" number of likes

    "Type" type of media

    "CreationDate"  ▪  "Link"  ▪  "Location"

    Parameters:
  • "MediaID"(required)media ID
  • Tags

    Requests:

    "TaggedMedia" import media with the specified tag

    Parameters:
  • "Tag"(required)hashtag
    "Elements""Data"data elements to return
    MaxItems20number of results to return
    "MediaResolution""Standard"media resolution
  • Requests:

    "TaggedMediaURLs" link to media with the specified tag

    Parameters:
  • "Tag"(required)hashtag
    MaxItems20number of results to return
    "MediaResolution""Standard"media resolution
  • Requests:

    "TaggedMediaIDs" media IDs associated with a tag

    Parameters:
  • "Tag"(required)hashtag
    MaxItems20number of results to return
  • Search

    Requests:

    "UserSearch" search for users

    "TagSearch" search for hashtags

    Parameters:
  • "Query"(required)query string
  • Request:

    "MediaSearch" search media by location

    Parameters:
  • "Location"(required)location of media (GeoPosition, GeoDisk, or Entity)
    "Elements"Datadata elements to return
    "Distance"1000search distance in meters
    MaxItems20number of results to return
    "MediaResolution""Standard"media resolution

Parameter Details

    Possible settings for "Elements" include:
  • "Images"return a list of images
    "Data"return a dataset with a limited set of fields
    "FullData"return a dataset with all available fields
    "LinkedThumbnails"return a list of hyperlinked thumbnails
    "LinkedVideos"return a list of hyperlinked videos
  • Possible settings for "MediaResolution" include:
  • "Low"return low-resolution media
    "Standard"return standard-resolution media

Examples

Basic Examples  (1)

Create a new connection by launching an authentication dialog:

In[1]:=
Click for copyable input
Out[1]=

Search for a user:

In[2]:=
Click for copyable input
Out[2]=

Import recent media from you:

In[3]:=
Click for copyable input
Out[3]=

Find who is following you:

In[4]:=
Click for copyable input
Out[4]=

Search for media by hashtag:

In[5]:=
Click for copyable input
Out[5]=

Search for recent media taken near a given location:

In[6]:=
Click for copyable input
Out[6]=

See Also

ServiceExecute  ▪  ServiceConnect  ▪  Facebook  ▪  Twitter