我看了看instafeed.js。它工作得很好,我跟踪了第一个文档,得到了一个在网页上显示的20个图像样本。
然而,我真的需要从某个地方(在我的例子中,城市)获取照片。使用Twitter时,我曾经为想要的地方寻找WOEID
。这里的情况似乎很相似。
我读过Instagram文档
DISTANCE Default is 1000m (distance=1000), max distance is 5000.
FACEBOOK_PLACES_ID Returns a location mapped off of a Facebook places id. If used, a Foursquare id and lat, lng are not required.
FOURSQUARE_ID Returns a location mapped off of a foursquare v1 api location id. If used, you are not required to use lat and lng. Note that this method is deprecated; you should use the new foursquare IDs with V2 of their API.
LAT Latitude of the center search coordinate. If used, lng is required.
LNG Longitude of the center search coordinate. If used, lat is required.
FOURSQUARE_V2_ID Returns a location mapped off of a foursquare v2 api location id. If used, you are not required to use lat and lng.
但我在哪能拿到这样的城市身份证呢。假设我想要在墨西哥普埃布拉用晚餐标记的照片。我该怎么办呢。
我使用这个很好的站点从我的坐标:http://maihamakyo.org/etc/locastagram/index.php获得一个ID
然后尝试了这个Java脚本代码:
var feed = new Instafeed({
get: 'tagged',
location: '46016173',
tagName: 'CLEU',
clientId: '***'
})
feed.run();
但没有得到预期的结果。
发布于 2014-05-22 15:06:53
从版本1.3开始,您可以向Instafeed.js添加一个过滤器函数,以从结果中排除图像。
因此,您应该能够设置get: "location"
和locationId
,然后筛选出不包含要查找的标记的任何图像:
var feed = new Instafeed({
get: 'location',
locationId: LOC_ID,
// other settings omitted for example
filter: function(image) {
return image.tags.indexOf('TAG_NAME') >= 0;
}
});
feed.run();
更新
传递给image
函数的filter
参数是Instagram的API中的图像数据。所以你可以过滤任何你想要的标准。只需确保函数返回true
或false
filter: function(image) {
if (image.tags.indexOf('TAG_NAME') >= 0 && image.filter === "Normal") {
return true;
}
return false;
}
要了解image
对象具有哪些属性,请检查GitHub上的这条线。
发布于 2014-04-07 01:04:15
查看instafeed.js文档,位置的选项名称/键应该是locationId
。
我不熟悉Instagram API,但是instafeed.js文档很大程度上暗示了需要将get
设置为location
才能使用位置ID,因此很有可能您只能搜索标记或位置,而不能同时搜索两者。
https://stackoverflow.com/questions/22901985
复制相似问题