从 YouTube 获取用户的所有播放列表。在 api 资源管理器中工作,但不在 C# 中工作

get all playlist of an user from YouTube. working in api explorer but not in c#

我想获取一个频道的所有播放列表 所有设置都适用于 API 资源管理器,但是当我在客户端中尝试时它不起作用 youtube 数据 api3 的其他功能,如频道和播放列表项目,我的问题只是 playlist.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");

我找到了我的解决方案 这只是一个错字

channelVids.Id = "UCIabPXjvT5BVTxRDPCBBOOQ";

channelVids.ChannelId = "UCIabPXjvT5BVTxRDPCBBOOQ";