Search code examples
jsonrestinstagraminstagram-api

Filter response from Instagram media feed


It is possible to fetch user's media feed from Instagram without authorization using below URL and control the data that is presented ?

https://www.instagram.com/{username}/media/

The response comes with JSON format:

{
  status: "ok",
  items:  [
    {
      can_delete_comments: false,
      code:                "BHN55zegQYk",
      location:            null,
      images:              {
        low_resolution:      {
          url:    "https://scontent-waw1-1.cdninstagram.com/t51.2885-15/s320x320/e35/13551611_1746490512297913_1853324944_n.jpg?ig_cache_key=MTI4MjkzNjEyOTgwNDM3MTQ5Mg%3D%3D.2.l",
          width:  320,
          height: 320
        },
        thumbnail:           {
          url:    "https://scontent-waw1-1.cdninstagram.com/t51.2885-15/s150x150/e35/c0.0.1079.1079/13534565_996407620456445_1170595894_n.jpg?ig_cache_key=MTI4MjkzNjEyOTgwNDM3MTQ5Mg%3D%3D.2.c",
          width:  150,
          height: 150
        },
        standard_resolution: {
          url:    "https://scontent-waw1-1.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/13551611_1746490512297913_1853324944_n.jpg?ig_cache_key=MTI4MjkzNjEyOTgwNDM3MTQ5Mg%3D%3D.2.l",
          width:  640,
          height: 640
        }
      },
      can_view_comments:   true,
      comments:            {
        count: 2,
        data:  [
          {
            created_time: "1467158133",
            text:         "#flowermuse #peonyseason #peonies #peonylove",
            from:         { /* user object */ },
            id:           "17848900168109698"
          },
          {
            created_time: "1467171168",
            text:         "😍!!",
            from:         { /* user object */ },
            id:           "17848905430109698"
          }
        ]
      },
      alt_media_url:       null,
      caption:             {
        created_time: "1467157926",
        text:         "The first of Alaskan peonies going out this week! 🙌",
        from:         { /* user object */ },
        id:           "17848900084109698"
      },
      link:                "https://www.instagram.com/p/BHN55zegQYk/",
      likes:               {
        count: 156,
        data:  [
          { /* user object */ },
          { /* user object */ },
          { /* user object */ },
          { /* user object */ }
        ]
      },
      created_time:        "1467157926",
      user_has_liked:      false,
      type:                "image",
      id:                  "1282936129804371492_25920898",
      user:                { /* user object */ }
    },
    { /* more media objects */ }
  ]
}

Is it possible somehow to filter this data ? For example I just need images parts of the returned items and I can easily skip the user data, their comments, likes, etc. I would like to limit data that is fetched just to the image sources and its description.


Solution

  • You cannot access any Instagram API without authorization anymore, You will need access_token.

    You cannot get a filtered JSON feed with just images, the json data feed is very small, you can just grab the entire feed and make a filtered feed on client end.