Instagram feed based on tag and geolocation

前端 未结 2 807
天命终不由人
天命终不由人 2020-12-29 15:38

Is it possible to get an instagram feed based on both a tag and location?

I want all the images tagged with #stackExchange located in Johannesburg ( and surrounding

2条回答
  •  [愿得一人]
    2020-12-29 16:10

    As krisrak said - you need to choose: either get by location and then filter by tag or get by tag and then filter by location. check instafeed.js - you can use this for example (get by location and then filter by tag):

    var mylocation = 1234569; //must be a number! 
    
    var feed = new Instafeed({
      get: 'location',
      locationId: mylocation,
    
      clientId: 'someId', //change this with the client id you get from Instagram
    
      filter: function(image) {
        return (image.tags.indexOf('myTag') >= 0);
      }
    });
    feed.run();
    

    You can find the location you want in google maps. right click the specific point on the map and choose "what's here?" - this will reveal the coordinates. now use this site to get the Instagram locationId.

    Notice that image object has all the properties returned by the Instagram api, so you can get the tags, the location, comments... fora full list of fields look at returned media api (click on response button).

    but just remember: filter function must return boolean!

提交回复
热议问题