列出Google Apps脚本中Youtube频道的所有视频

时间:2016-01-31 06:47:11

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

我正在使用java.nio在Google电子表格中列出前25个视频节目和频道的ID,但出于某种原因,我只获得频道的标题。这是我的代码,

Youtube Data API

我是youtube数据api的新手,所以我不知道我在这里做错了什么。如何使用Google Apps脚本在电子表格中列出25个视频ID和标题?急需这个帮助!感谢。

1 个答案:

答案 0 :(得分:0)

The documentation for the YouTube.Channels states that it will return information about the Channel, nothing about the videos, that's why your getting the channel's info.

YouTube.Search on the other hand gather info about videos, and you can feed it a channelId parameter that will seek into a specified channel, as such, your result code should look like:

  var results = YouTube.Search.list('id,snippet', {
    channelId:'UC-9-kyTW8ZkZNDHQJ6FgpwQ',
    maxResults: 25
  });