Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve Instagram video embed URL from API

I'm trying to find to programmatically get the embed link for an Instagram video. Unfortunately, it appears that Instagram's oEmbed endpoint, treats videos as photos, and only returns the key frame image, rather than providing an embed link.

Does anyone know of a way to retrieve the embed link for an instagram video without having to manually visit the page for that video?

like image 564
Josh Ourisman Avatar asked Jul 22 '13 15:07

Josh Ourisman


1 Answers

According to Instagram's API site a GET /media/media-id request for a video object returns a JSON object with the information you need in "data.videos.low_resolution.url".

I successfully embedded the video returned by their sample request into a web page with the following code:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Video Embed Test</title>
  </head>
  <body>
    <video width="480" height="480" controls>
    <source src="http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_102.mp4" 
      type="video/mp4"/>
    </video>
  </body>
</html>
like image 153
Elzair Avatar answered Oct 06 '22 03:10

Elzair