我正在使用v3 Google YouTubeAPI从频道获取所有视频,但在3个可用视频中,只返回一个。什么出了什么问题?以下是该函数的代码:
public List<Video> GetVideos()
{
var vids = new List<Video>();
YouTubeService youtube = new YouTubeService(new BaseClientService.Initializer());
SearchResource.ListRequest listRequest = youtube.Search.List("id,snippet");
listRequest.Key = WebConfigurationManager.AppSettings["youTubeKey"];
listRequest.ChannelId = WebConfigurationManager.AppSettings["youTubeChannel"];
listRequest.MaxResults = 25;
listRequest.Type = "video";
SearchListResponse resp = listRequest.Execute();
foreach (SearchResult result in resp.Items)
{
vids.Add(new Video(result.Id.VideoId, result.Snippet));
}
return vids;
}
我确认所有3个视频都是公开的,并在YouTube上播放。