Google YouTube API not fetching all videos
I am using v3 Google YouTubeAPI to get all videos from a channel, but out of 3 available, only one is returned. Any idea what's going wrong? Here is the code for the function:
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;
}
I made sure all 3 videos are public and playable on YouTube.
+3
source to share
1 answer
Without a channel id, I find it difficult to help, but I have to ask:
Are you getting the correct results from the browser API ?
0
source to share