YouTube/Vimeo API - MP4 files

痴心易碎 提交于 2019-11-30 05:32:14
marcdown

First of all, according to API 3 Link to video not showing Vimeo is now handling API support here with additional support via Email.

For a PRO account, here are the steps to accessing MP4 files for your videos on Vimeo using the new V3 API:

  1. Create a new Vimeo app here: https://developer.vimeo.com/apps/new
  2. Once created, click on the oAuth2 button at the top and copy your access token.
  3. Make a GET request to https://api.vimeo.com/videos/VIDEO_ID and add the Header "Authorization : Bearer ACCESS_TOKEN" where VIDEO_ID is the ID in the standard Vimeo URL and ACCESS_TOKEN is the token from #2.

This will return a "files" key that includes multiple video sizes.

If you're not a PRO user or are attempting to access files uploaded by other users, this link seems to do the trick: http://player.vimeo.com/v2/video/VIDEO_ID/config. This only works if the video is downloadable.

On Vimeo, PRO users have direct access to all of their video file links through the New API.

This includes any formats they generate (hd, sd, etc) and an hls stream.

In ASP or c# you can use below code, this will return you json string

        string url = "https://api.vimeo.com/me/videos/" + videoId;


        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

        request.Method = "GET";
        request.Accept = "application/vnd.vimeo.*+json;version=3.0";


        request.Headers.Add(HttpRequestHeader.Authorization, "Bearer YOUR_ACCESS_TOKEN");
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        Stream resStream = response.GetResponseStream();

        var reader = new StreamReader(resStream);

        string jsonResponse = reader.ReadToEnd();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!