问题描述
我正在为此项目使用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
我的问题是:我缺少什么论点?
解决方法
我相信您的目标如下。
- 您要使用Google Apps脚本在播放列表中插入一个项目。
修改点:
- 使用
Dog
时,参数分别是YouTube.PlaylistItems.insert(resource,part)
和resource
,分别是对象和字符串数组。
修改脚本后,它如下所示。
修改后的脚本:
part