Youtube.Playlist.list ReferenceError

时间:2015-05-18 15:59:39

标签: google-apps-script youtube-analytics-api youtube-data-api

当我在Google App脚本中使用Youtube.Playlists.list时,我遇到错误,上面写着“ReferenceError:”Youtube“未定义”。我启用了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);
      }
}

1 个答案:

答案 0 :(得分:0)

您需要做的就是更改小写字母&#34; t&#34;大写:

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

更改为:

YouTube

它区分大小写: