I\'m am looking for the MediaID
of an Instagram image which has been uploaded. It should look like
1234567894561231236_33215652
http://api.instagram.com/oembed?url=http://instagram.com/p/Y7GF-5vftL/
Render as json object and you can easily extract media id from it ---
For instance, in 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'];
For instance, in 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){}
}
});
Try the solution from this question: How can I get an direct Instagram link from a twitter entity?
You can get just the image by appending /media/ to the URL. Using your
You can even specify a size,
One of t (thumbnail), m (medium), l (large). Defaults to m.
So for a thumbnail: http://instagr.am/p/QC8hWKL_4K/media/?size=t
If you add ?__a=1
at the end of Instagram public URLs, you get the data of the public URL in JSON.
For the media ID
of an image from post URL, simply add the JSON request code at the post URL:
http://instagram.com/p/Y7GF-5vftL/?__a=1
The response will look like this below. You can easily recover the image ID from the "id"
parameter in the reply...
{
"graphql": {
"shortcode_media": {
"__typename": "GraphImage",
"id": "448979387270691659",
"shortcode": "Y7GF-5vftL",
"dimensions": {
"height": 612,
"width": 612
},
"gating_info": null,
"fact_check_information": null,
"media_preview": null,
"display_url": "https://scontent-cdt1-1.cdninstagram.com/vp/6d4156d11e92ea1731377ef53324ce28/5E4D451A/t51.2885-15/e15/11324452_400723196800905_116356150_n.jpg?_nc_ht=scontent-cdt1-1.cdninstagram.com&_nc_cat=109",
"display_resources": [