如何使用Youtube API v3按ID检索视频? [英] How do I retrieve a Video by ID with Youtube API v3?

查看:195
本文介绍了如何使用Youtube API v3按ID检索视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得一个涉及Youtube上单个视频的回复.假设我知道它的ID,并且想看看它是否仍在YouTube上.请求的外观如何?

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?

我正在将google-api-client与client_id和client_secret一起使用,并且喜欢这样做:

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'})

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?

推荐答案

您应该执行 videoId 列表调用>.

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' })

这篇关于如何使用Youtube API v3按ID检索视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆