YouTube数据API:在单个请求中按ID检索多个视频条目 [英] Youtube Data API: Retrieving multiple Video entries by IDs in a single request

查看:122
本文介绍了YouTube数据API:在单个请求中按ID检索多个视频条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以查询YouTube的多个随机 单个查询中的视频(已知视频ID)? 我将视频ID存储在本地数据库中,需要显示多个 网页中的详细信息(带有拇指,等级,作者姓名等的列表).

I am wondering if there is a way to query YouTube for multiple random videos (video id's are known) in a single query? I am storing video id's in the local db and need to show multiple details(list with thumbs, rating, author name,etc.) in the web page.

我正在查看Youtube Data API,发现我可以 实体数据是这样的:

I am looking at the Youtube Data API and see that I can a single entity data like this:

Uri  videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/video_id");
Video video = request.Retrieve<Video>(videoEntryUrl);

在循环中重复此操作似乎不是一个好主意,因为 配额.

Repeating this in the loop seems to be a bad idea, because of the quotas.

还有批处理"可用- http://code.google.com/apis/youtube/2.0/developers_guide_dotnet .html#Batch_processing . 似乎我最多可以发出50个随机请求,但是它期望一些 执行批处理时,我没有参数feed. Uri有一些重载,但记录得不好-google-gdata.googlecode.com/svn/docs/folder59/M_Google_GData_Client_FeedRequest_1_Batch__1_2.htm

There is also "batch processing" available - http://code.google.com/apis/youtube/2.0/developers_guide_dotnet.html#Batch_processing. Seems like I can issue up to 50 random request, but it expects some feed I don't have as a parameter, when executing batch. There is an overload with some Uri, but it is not documented well - google-gdata.googlecode.com/svn/docs/folder59/M_Google_GData_Client_FeedRequest_1_Batch__1_2.htm

有人对如何检索多个视频条目有任何想法吗? 凭身份证吗?任何帮助将不胜感激.

Does anybody have any ideas on how to retrieve multiple video entries by id's? Any help would be appreciated.

推荐答案

在Youtube Data API 3.0版中,您可以像这样简单地完成它.

In Youtube Data API version 3.0 You can do it in a simple way like this.

https://www.googleapis.com/youtube/v3/videos?key=API_KEY&part=snippet&id=video_id1,video_id2

只需添加您的视频ID(以逗号分隔)即可.它将为您获取JSON中所有视频的数据

Just add your video ids separated by comma. It will fetch you the data for all videos in JSON

我不知道这是什么限制,一旦找到答案,它就会更新答案.

I dont know what is the limit on this, will update the answer once I find it.

这篇关于YouTube数据API:在单个请求中按ID检索多个视频条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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