【发布时间】:2020-11-30 13:21:22
【问题描述】:
我正在为这个项目使用 Google 的 Apps 脚本。我正在使用 YouTube 数据 API V3,并且我正在使用 PlaylistItems 类。我正在尝试将视频插入播放列表,并且我已从他们提供的文档中拼凑出我所能做的。
YouTube.PlaylistItems.insert({
"part": [
"snippet"
],
"resource": {
"snippet": {
"playlistId": "PL5t3YGq3D2WnrLyuYL9WCgprQ2RUcwl8a",
"position": 0,
"resourceId": {
"kind": "youtube#video",
"videoId": testVidId
// testVidId is the ID of the video I'm trying to insert
}
}
}
});
当我运行它时,我得到一个错误
Exception: Invalid number of arguments provided. Expected 2-3 only
我的问题是:我缺少什么论据?
【问题讨论】:
-
通过查看包的实际代码,它看起来应该是
requestBody而不是resource(see here)。他们可能在文档中犯了一个错误,他们像你一样使用resource -
他们在 2018 年更改了 this pull request
标签: javascript google-apps-script youtube-api youtube-data-api