Learning
Learning

Reputation: 20011

How to get user based and tag based photos from instagram

I have a requirement where i have to show instagram photos from users account xxxx and photos tagged as x,x2,x3,x4.

Is it possible to do to both user account based and tagged based photos in with instafeed.js script

Codepen

Script

var instaFeed = new Instafeed({
                    get: 'user',
                    userId: 6678174,
                    accessToken: '6678174.467ede5.205a03ebc4b74d4082823781c3149575',
                    target: 'instafeed',
                    sortBy: 'most-recent',
                    limit: 32,
                    resolution: 'standard_resolution',
  template: '<a class="fancybox" href="{{image}}"><img src="{{image}}" /><div id="filter">{{model.filter}}</div><div class="info"><p class="location"><i class="icon-location"></i>{{location}}</p><p><i class="icon-comment"></i>{{caption}}</p><br><ul><li class="icon-heart">{{likes}} likes<li class="icon-chat">{{comments}} comments</ul></div></a>'
}).run();

$.fn.extend({
  matchHeight: function(data){
    var maxHeight = 0;
    $(this).each(function() {
       maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
    });
   $(this).height(maxHeight);
  }
});

Upvotes: 1

Views: 1621

Answers (1)

krisrak
krisrak

Reputation: 12952

There is no single API that will allow you to do both user and hashtag search.

You can use the user/media API to get photos and manually check for the hashtag in tags of each photo in API response

https://api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN

http://gramfeed.com has implemented this, search and open a user page on gramfeed, scroll and load all photos, and then use the filter by keyword to filter photos with an hashtag

Upvotes: 1

Related Questions