有人可以告诉我为什么我不能拉动用户从频道上传视频?我不知道我的代码中还有什么可能遗漏的东西,似乎一切都在那里,但我总是在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();
...谢谢
答案 0 :(得分:1)
在构建playlistRequest
时,您必须设置playlistId
参数而不是id
参数:
playlistRequest.PlaylistId = uploadsPlaylistID;