我想获取频道的所有播放列表 所有设置都可以在API资源管理器上使用,但是当我在客户端中尝试使用时,它不起作用 youtube数据api3的其他功能(例如频道和播放列表项)正常运行,我的问题仅在于播放列表.list
UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
// This OAuth 2.0 access scope allows for full read/write access to the
// authenticated user's account.
new[] { YouTubeService.Scope.Youtube },
"user",
CancellationToken.None,
new FileDataStore(this.GetType().ToString())
);
}
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = this.GetType().ToString()
});
var channelVids = youtubeService.Playlists.List("snippet");
channelVids.Id = "UCIabPXjvT5BVTxRDPCBBOOQ";
//channelVids.Fields = "items(id,snippet(description,publishedAt,thumbnails/default/url,title)),nextPageToken";
channelVids.MaxResults = 25;
var results = await channelVids.ExecuteAsync();
Console.WriteLine(results.Items.Count + " lists");
答案 0 :(得分:0)
我找到了解决方案 只是一个错字
channelVids.Id = "UCIabPXjvT5BVTxRDPCBBOOQ";
到
channelVids.ChannelId = "UCIabPXjvT5BVTxRDPCBBOOQ";