Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I find the Instagram media ID of a image

I'm am looking for the MediaID of an Instagram image which has been uploaded. It should look like

1234567894561231236_33215652

I have found out the last set of integers are the usersID

For example: this is the link for the image directly, however I see no mediaID in the correct format?

http://distilleryimage11.ak.instagram.com/d33aafc8b55d11e2a66b22000a9f09de_7.jpg 

while this is the link

http://instagram.com/p/Y7GF-5vftL/ 

I don't wish to use the API as all I need the MediaID from a selected image.

like image 533
Taz Avatar asked May 26 '13 10:05

Taz


People also ask

What is Media ID?

The MediaID is a unique 7 digit number generated by Encoding.com that allows users to track jobs by incremental number. When you submit a job via XML, or via our WebUI, you'll receive a MediaID when you submit your job. Via XML, you'll receive this back as a post.

Is Instagram API open?

In 2018, Instagram shut down its public API. Meaning, third-party apps can no longer access the API from Instagram without permission. Third-party apps now need to be approved by Instagram before they can access the API.


1 Answers

Here's a better way:

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/Y7‌​GF-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){}        }  }); 
like image 89
George Avatar answered Sep 19 '22 13:09

George