7

I want to skip all video type posts from a feed that I'm gathering through the Instafeed JS plugin. Read from a few other posts that setting a filter would solve it but if I apply this (see below) I only get 2 images instead of 5. 1 of those 5 are a video type and the rest are image types. Not sure whats going on here?

var loadButton = document.getElementById('instafeed-loadmore');
            var feed = new Instafeed({
                get: 'user',
                type: 'image',
                limit: '5',
                sortBy: 'most-recent',
                resolution: 'standard_resolution',
                userId: '',
                accessToken: '',
                template: '<div><a href="#" data-modal="instafeed-expand" data-caption="{{caption}}" data-image="{{image}}"><img src="{{image}}" data-etc=""></a></div>',
                filter: function(image) {
                    return image.type === 'image';
                },
                after: function() {
                    if (!this.hasNext()) {
                        loadButton.setAttribute('disabled', 'disabled');
                    }
                },
            });

            loadButton.addEventListener('click', function() {
                feed.next();
            });
Staffan Estberg
  • 6,795
  • 16
  • 71
  • 107

2 Answers2

2

Maybe removing the resolution parameter should help. Also I dont think

type: 'image',

is a valid argument. I cant find it in the instafeed documentation as well.

cyberrspiritt
  • 908
  • 8
  • 26
0

TRy following

var feed = new Instafeed({
  get: "user",
  userId: "xxxx",
  accessToken: "xxxx",
  filter: function(image) {
    if (image.type === "image") {
      return false;
    }
    return true;
  }
});
feed.run();
Learning
  • 19,469
  • 39
  • 180
  • 373