Reputation: 89
Can someone enlighten me as to why I cannot pull the user upload videos from a channel? I don't know what else I could be missing in my code, everything seems to be there but I always get back a zero on my playlistresponse.items.
var youtubeService = new YouTubeService(new BaseClientService.Initializer() { ApiKey = "API-KEY" }); // mypersonal key
var ChannelSectionRequest = youtubeService.Channels.List("contentDetails");
ChannelSectionRequest.Id = channelID;
var ChannelSectionResponse = await ChannelSectionRequest.ExecuteAsync();
foreach (var ChannelSectionItem in ChannelSectionResponse.Items)
{
var uploadsPlaylistID = ChannelSectionItem.ContentDetails.RelatedPlaylists.Uploads;
var nextPageToken = "";
while (nextPageToken != null)
{
var playlistRequest = youtubeService.PlaylistItems.List("snippet");
playlistRequest.Id = uploadsPlaylistID;
playlistRequest.MaxResults = 50;
playlistRequest.PageToken = nextPageToken;
var playlistResponse = await playlistRequest.ExecuteAsync();
Thanks...
Upvotes: 2
Views: 46
Reputation: 2577
You must set the playlistId
parameter rather than the id
parameter while building playlistRequest
:
playlistRequest.PlaylistId = uploadsPlaylistID;
Upvotes: 1