为什么我只能从 Feed 中获取 25 个 YouTube 视频?
我在 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 个视频!
我知道视频的最大数量饲料是 999 :
API 返回视频源以响应搜索视频的请求。视频源最多包含 999 个条目。要检索搜索结果,请将 API 请求发送到以下 URL:
http://gdata.youtube.com/feeds/projection/videos?v=2
那么为什么是 25?
尝试使用 uploads/?start-index=0&max-results=999
但没有任何结果...
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
}
but I can retrieve only 25 video!
I know the max number of video in a feed is 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. To retrieve search results, send an API request to the following URL:
http://gdata.youtube.com/feeds/projection/videos?v=2
So why 25?
Tried with uploads/?start-index=0&max-results=999
but nothing...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
999 这个数字是指播放列表或源中可以存在的视频的最大数量:
默认情况下它返回 25 个结果,但您可以覆盖它:
http://code.google.com/intl/it-IT/apis/youtube/2.0/reference.html#max-resultssp
max-results
的最大值为 50 ,因此,您需要使用start-index
发出多个请求来获取每个结果块。The 999 figure refers to the maximum number of videos that can exist in a playlist or feed:
By default it returns 25 results, though you can override this:
http://code.google.com/intl/it-IT/apis/youtube/2.0/reference.html#max-resultssp
The maximum value of
max-results
is 50, so you'll need to issue multiple requests usingstart-index
to fetch each block of results.