Where do I find the Instagram media ID of a image

后端 未结 15 1440

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

1234567894561231236_33215652

15条回答
  •  感动是毒
    2020-12-22 20:14

    In pure JS (provided your browser can handle XHRs, which every major browser [including IE > 6] can):

    function igurlretrieve(url) {
    
      var urldsrc = "http://api.instagram.com/oembed?url=" + url;
    
      //fetch data from URL data source
      var x = new XMLHttpRequest();
      x.open('GET', urldsrc, true);
      x.send();
    
      //load resulting JSON data as JS object
      var urldata = JSON.parse(x.responseText);
    
      //reconstruct data as "instagram://" URL that can be opened in iOS app
      var reconsturl = "instagram://media?id=" + urldata.media_id;
      return reconsturl;
    
    }
    

    Provided this is your goal -- simply opening the page in the Instagram iOS app, which is exactly what this is about -- this should do, especially if you don't want to have to endure licensing fees.

提交回复
热议问题