Youtube.Playlist.list 引用错误

Youtube.Playlist.list ReferenceError

当我在 Google 应用程序脚本中使用 Youtube.Playlists.list 时,我遇到一个错误,提示 "ReferenceError: "Youtube" is not defined"。我启用了 Youtube Analytics API 和 Youtube Data API 但错误仍然出现。我可以知道如何使这项工作吗?

function myFunction() {

  var playlistResponse = Youtube.Playlists.list('snippet',{
    mine: true,
        maxResults: 30,
        pageToken: nextPageToken
      });

  for (var x = 0; x < playlistResponse.items.length; x++)
      {
      var playlistItem = playlistResponse.items[x];
      var playlistId = playlistResponse.items.id;
      var playlistTitle = playlistResponse.items.snippet;

        Logger.log(playlistTitle);
        Logger.log(playlistId);
      }
}

您只需要把小写字母"t"改成大写即可:

var playlistResponse = Youtube.Playlists.list('snippet',{

更改为:

YouTube

区分大小写: