我正在寻找已上传的 Instagram 图像的 MediaID
。它应该看起来像
1234567894561231236_33215652
我发现最后一组整数是
usersID
例如:这是直接指向图像的链接,但是我没有看到格式正确的
mediaID
?http://distilleryimage11.ak.instagram.com/d33aafc8b55d11e2a66b22000a9f09de_7.jpg
虽然这是链接
http://instagram.com/p/Y7GF-5vftL/
我不希望使用 API,因为我只需要来自选定图像的 MediaID。
最佳答案
这是一个更好的方法:
http://api.instagram.com/oembed?url=http://instagram.com/p/Y7GF-5vftL/
渲染为 json 对象,您可以轻松地从中提取媒体 ID ---
例如,在 PHP 中
$api = file_get_contents("http://api.instagram.com/oembed?url=http://instagram.com/p/Y7GF-5vftL/");
$apiObj = json_decode($api,true);
$media_id = $apiObj['media_id'];
例如,在 JS 中
$.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 - 在哪里可以找到图片的 Instagram 媒体 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16758316/