我正在寻找MediaID
已上传的 Instagram 图片。它应该看起来像
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){}
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)