mfilippov / vimeo-dot-net

A .NET wrapper for Vimeo API v3.0
MIT License
98 stars 88 forks source link

GetVideoAsync not retrieving Download links #189

Open simutechgroup opened 1 year ago

simutechgroup commented 1 year ago

Calling GetVideoAsync doesn't retrieve the Download links any longer. It was working in previous versions.

mfilippov commented 1 year ago

@simutechgroup Could you add code example with issue? I'm not understand what is DownloadLink. In API video had link field and it loaded correctly as far as I see.

simutechgroup commented 1 year ago

@mfilippov

Thanks for your comment. Using the following code I am trying to get a download link of the video, to grab the source of the video and put it somewhere else for example. The code works fine, but the Download field comes back empty.

var v = await client.GetVideoAsync(VideoId, new[] { "uri", "name", "download" }); if (v != null && v.Download != null && v.Download.Any()) { return v.Download.FirstOrDefault().Link; }

mfilippov commented 1 year ago

I add a test to verify download link behaviour: https://github.com/mfilippov/vimeo-dot-net/commit/9f572f65748f371c90fd283c18d1baeb3134be97. While investigating an issue, I found behaviour: Vimeo requires a Standard account to allow downloading video. And you also need a token with the right permissions to do it. Try to call Vimeo API Reference: Videos with your app permissions and check download section availability in JSON. Who it should look if all is ok: https://github.com/mfilippov/vimeo-dot-net/blob/9f572f65748f371c90fd283c18d1baeb3134be97/src/VimeoDotNet.Tests/TestData/Video/video-833078000.json#LL739C3-L739C3

simutechgroup commented 1 year ago

@mfilippov Thanks for that. We have a pro license and we are able to download videos using our current token both via Vimeo's API playground and node.Js SDK. Older versions of VimeoDotNet still works fine with our current token.

mfilippov commented 1 year ago

@simutechgroup But it didn't work well with the new library version. Is it true? Could you help me to understand what is going on. I need JSON response for video which didn't work. To receive it you could put breakpoint into line: https://github.com/mfilippov/vimeo-dot-net/blob/9f572f65748f371c90fd283c18d1baeb3134be97/src/VimeoDotNet/Net/ApiRequest.cs#LL170C15-L170C15

simutechgroup commented 1 year ago

@mfilippov Correct, here are the Json files with name, uri and download fields:

1- From VimeoDotNet (missing "download") {"uri":"/videos/334454885","name":"Creating Thin Baffle Surfaces in SpaceClaim and Meshing for CFD Simulations"}

2- From Vimeo Directly (correct) { "uri": "/videos/334454885", "name": "Creating Thin Baffle Surfaces in SpaceClaim and Meshing for CFD Simulations", "download": [ { "quality": "sd", "rendition": "360p", "type": "video/mp4", "width": 640, "height": 360, "expires": "2023-06-18T00:48:43+00:00", "link": "https://player.vimeo.com/progressive_redirect/download/334454885/container/46e2414a-838b-4eff-9f30-e8c852a9bb86/2fc8e69e/creating_thin_baffle_surfaces_in_spaceclaim_and_meshing_for_cfd_simulations%20%28360p%29.mp4?expires=1687049323&loc=external&signature=6297c659461471772c14af5a96f21da4fc328bbc373534b81ab950e9a883ea52", "created_time": "2019-05-06T15:26:38+00:00", "fps": 30, "size": 15408140, "md5": "fe32423c7c79bcc71a0020f7138e9316", "public_name": "360p", "size_short": "14.69MB" }, { "quality": "sd", "rendition": "240p", "type": "video/mp4", "width": 426, "height": 240, "expires": "2023-06-18T00:48:43+00:00", "link": "https://player.vimeo.com/progressive_redirect/download/334454885/container/46e2414a-838b-4eff-9f30-e8c852a9bb86/626ba96d/creating_thin_baffle_surfaces_in_spaceclaim_and_meshing_for_cfd_simulations%20%28240p%29.mp4?expires=1687049323&loc=external&signature=969dfa4283aa66503b4e733350b77c7f666e0cb7f437c3f89c00d7162f4b3dad", "created_time": "2019-05-06T15:26:27+00:00", "fps": 30, "size": 7106393, "md5": "5ec5afa8b8d9cb41eb53163836abba13", "public_name": "240p", "size_short": "6.78MB" }, { "quality": "sd", "rendition": "540p", "type": "video/mp4", "width": 960, "height": 540, "expires": "2023-06-18T00:48:43+00:00", "link": "https://player.vimeo.com/progressive_redirect/download/334454885/container/46e2414a-838b-4eff-9f30-e8c852a9bb86/7eeb70c4/creating_thin_baffle_surfaces_in_spaceclaim_and_meshing_for_cfd_simulations%20%28540p%29.mp4?expires=1687049323&loc=external&signature=864b2370c4ec777d79f6e63d3ebd698db033722c7003db0b7db9bda5468de495", "created_time": "2019-05-06T15:27:23+00:00", "fps": 30, "size": 23275176, "md5": "e171c0bcde53bc7ff2ad9e9f8c305f13", "public_name": "540p", "size_short": "22.2MB" }, { "quality": "hd", "rendition": "720p", "type": "video/mp4", "width": 1280, "height": 720, "expires": "2023-06-18T00:48:43+00:00", "link": "https://player.vimeo.com/progressive_redirect/download/334454885/container/46e2414a-838b-4eff-9f30-e8c852a9bb86/dfdbe17e/creating_thin_baffle_surfaces_in_spaceclaim_and_meshing_for_cfd_simulations%20%28720p%29.mp4?expires=1687049323&loc=external&signature=1bb1f6fcc7a6ce81bf169b1e90843f41e0bc717737f1c6d5e5ad05c23eb79ad4", "created_time": "2019-05-06T15:26:43+00:00", "fps": 30, "size": 33416570, "md5": "c240f7d41d97fff6a6d4fc3ead42a2a3", "public_name": "720p", "size_short": "31.87MB" }, { "quality": "hd", "rendition": "1080p", "type": "video/mp4", "width": 1920, "height": 1080, "expires": "2023-06-18T00:48:43+00:00", "link": "https://player.vimeo.com/progressive_redirect/download/334454885/container/46e2414a-838b-4eff-9f30-e8c852a9bb86/073df41e/creating_thin_baffle_surfaces_in_spaceclaim_and_meshing_for_cfd_simulations%20%281080p%29.mp4?expires=1687049323&loc=external&signature=ad78560565c7faa2783249a83f49c5d09bf982fb4af04ed51399b9e4a0ed54a6", "created_time": "2019-05-06T15:27:21+00:00", "fps": 30, "size": 52190531, "md5": "87db2ed6578c19dead70e76826425c56", "public_name": "1080p", "size_short": "49.77MB" }, { "quality": "source", "rendition": "source", "type": "video/mp4", "width": 1920, "height": 1080, "expires": "2023-06-18T00:48:43+00:00", "link": "https://player.vimeo.com/progressive_redirect/download/334454885/container/46e2414a-838b-4eff-9f30-e8c852a9bb86/66bcbbab/creating_thin_baffle_surfaces_in_spaceclaim_and_meshing_for_cfd_simulations%20%28Original%29.mp4?expires=1687049323&loc=external&signature=1510b00fe84bba52b97d0ff5befeebdbc1d13ef8dffed7fa5387ddd1ac2f6ced", "created_time": "2019-05-06T15:24:31+00:00", "fps": 30, "size": 65174973, "md5": null, "public_name": "source", "size_short": "62.16MB" } ] }

mfilippov commented 1 year ago

@simutechgroup I reproduced issue on the public available video https://vimeo.com/263945543 I will ask vimeo support about it.

cboyce428 commented 1 year ago

As a workaround the default request is as follows:

GET https://api.vimeo.com/videos/YOURVIDEOID HTTP/1.1 Authorization: Bearer YOURTOKEN Accept: application/vnd.vimeo.*+json; version=3.4, application/json Host: api.vimeo.com Connection: Keep-Alive

I found if you remove ; version=3.4, application/json from accept it returns the "Files" element which includes the download urls.

Seems like a vimeo bug.

cboyce428 commented 1 year ago

Better workaround create a new app in vimeo, and assign permission "Video Files". It seems vimeo internally links the accesstoken to a particular api version.

The download element will then populate with links.