从 Instagram 获取位置信息 link
Get location info from a Instagram link
我可以从 Instagram link 获取信息吗,例如:https://instagram.com/p/7u46R_Ia9X/
我发现我们可以使用 Instargram API 获取带有位置 ID 的信息,但我不知道如何像上面那样从 link 获取位置 ID 或位置信息。
非常感谢
更新:我们可以通过回答解决,如果您没有访问令牌,我们可以通过简单的 link 接收:
http://bobmckay.com/web/simple-tutorial-for-getting-an-instagram-clientid-and-access-token/
您首先需要获取图像的 media-id
值,然后使用以下端点获取 location-id
和其他相关信息。
https://api.instagram.com/v1/media/{media-id}?access_token=ACCESS-TOKEN
此端点的响应returns位置以及媒体的所有详细信息。
在 JS 中从 instagram url 获取媒体 ID 的代码
$.ajax({
type: 'GET',
url: 'http://api.instagram.com/oembed?callback=&url=http://instagram.com/p/Y7GF-5vftL/',
cache: false,
dataType: 'jsonp',
success: function(data) {
try{
var media_id = data[0].media_id;
}catch(err){}
}
});
我可以从 Instagram link 获取信息吗,例如:https://instagram.com/p/7u46R_Ia9X/ 我发现我们可以使用 Instargram API 获取带有位置 ID 的信息,但我不知道如何像上面那样从 link 获取位置 ID 或位置信息。 非常感谢
更新:我们可以通过回答解决,如果您没有访问令牌,我们可以通过简单的 link 接收: http://bobmckay.com/web/simple-tutorial-for-getting-an-instagram-clientid-and-access-token/
您首先需要获取图像的 media-id
值,然后使用以下端点获取 location-id
和其他相关信息。
https://api.instagram.com/v1/media/{media-id}?access_token=ACCESS-TOKEN
此端点的响应returns位置以及媒体的所有详细信息。
在 JS 中从 instagram url 获取媒体 ID 的代码
$.ajax({
type: 'GET',
url: 'http://api.instagram.com/oembed?callback=&url=http://instagram.com/p/Y7GF-5vftL/',
cache: false,
dataType: 'jsonp',
success: function(data) {
try{
var media_id = data[0].media_id;
}catch(err){}
}
});