为什么我只能从提要中获得 25 个 YouTube 视频? [英] Why can I get only 25 YouTube video from a feed?

查看:24
本文介绍了为什么我只能从提要中获得 25 个 YouTube 视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 C#/.NET 上有这段代码:

I have this code on C#/.NET :

string user = "Username";
string feedUrl = "http://gdata.youtube.com/feeds/api/users/" + user + "/uploads";
Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl));

foreach (Video entry in videoFeed.Entries)
{
    // print video
}

但我只能检索 25 个视频!

but I can retrieve only 25 video!

知道最大数量Feed 中的视频数为 999:

I know the max number of video in a feed is 999 :

API 返回视频供稿以响应搜索视频的请求.一个视频 Feed 最多包含 999 个条目.要检索搜索结果,请向以下 URL 发送 API 请求:

The API returns a videos feed in response to a request to search for videos. A videos feed contains a maximum of 999 entries. To retrieve search results, send an API request to the following URL:

http://gdata.youtube.com/feeds/projection/videos?v=2

那么为什么是 25?

尝试使用 uploads/?start-index=0&max-results=999 但没有...

Tried with uploads/?start-index=0&max-results=999 but nothing...

推荐答案

999这个数字是指一个播放列表或Feed中可以存在的最大视频数:

The 999 figure refers to the maximum number of videos that can exist in a playlist or feed:

API 返回视频供稿以响应搜索视频的请求.一个视频 Feed 最多包含 999 个条目.

The API returns a videos feed in response to a request to search for videos. A videos feed contains a maximum of 999 entries.

默认情况下它返回 25 个结果,但您可以覆盖它:

By default it returns 25 results, though you can override this:

max-results 参数指定结果的最大数量应该包含在结果集中.该参数适用于结合 start-index 参数来确定哪些结果返回.例如,请求第二组 10 个结果——即结果 11-20 – 将 max-results 参数设置为 10 和start-index 参数为 11.此参数的默认值为25,最大值为 50.但是,对于显示列表视频,我们建议您将 max-results 参数设置为 10.

The max-results parameter specifies the maximum number of results that should be included in the result set. This parameter works in conjunction with the start-index parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the max-results parameter to 10 and the start-index parameter to 11. The default value of this parameter is 25, and the maximum value is 50. However, for displaying lists of videos, we recommend that you set the max-results parameter to 10.

http://code.google.com/intl/it-IT/apis/youtube/2.0/reference.html#max-resultssp

max-results 的最大值为 50,因此您需要使用 start-index 发出多个请求来获取每个结果块.

The maximum value of max-results is 50, so you'll need to issue multiple requests using start-index to fetch each block of results.

这篇关于为什么我只能从提要中获得 25 个 YouTube 视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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