How do I retrieve a Video by ID with Youtube API v3?

喜夏-厌秋 提交于 2019-12-24 13:32:30

问题


I'd like to get a Response referring to a single Video on Youtube. Let's say that I know its ID and like to see if it is still on Youtube. How does the request have to look like?

I am using the google-api-client with client_id and client_secret and like to do something like this:

client.execute( :api_method => youtube.search.list, :parameters => {:id => my_video_id, :part => 'id,snippet' })

It just returns me a Set of default Video Data. It is unlikely, that this is a matter of authentication, because uploading and deleting videos works fine. But for this purpose I can't find the right way. What am I doing wrong?


回答1:


You should do a videos->list call with the videoId instead.

client.execute( :api_method => youtube.videos.list, :parameters => {:id => my_video_id, :part => 'id,snippet' })


来源:https://stackoverflow.com/questions/21857970/how-do-i-retrieve-a-video-by-id-with-youtube-api-v3

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