且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 API 检索 Instagram 视频嵌入 URL

更新时间:2023-01-02 21:37:49

根据 Instagram 的 API 站点 对视频对象的 GET/media/media-id 请求返回一个 JSON 对象,其中包含您在data.videos.low_resolution.url"中所需的信息.

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>