我使用 npm install googleapis
命令下载并安装了Google APIs,现在我试图在我的Node.js文件中使用以下代码访问API:
var google = require('googleapis')
var youtube = google.youtube({version: 'v3', auth: API_KEY})
然而,当我尝试访问视频对象时,总是返回null
。 显然,youtube对象已损坏,因为当我将其字符串化时,我得到了这个结果:
{"_options":{"auth":"*********"},"activities":{},"captions":{},"channelBanners":{},"channelSections":{},"channels":{},"commentThreads":{},"comments":{},"guideCategories":{},"i18nLanguages":{},"i18nRegions":{},"liveBroadcasts":{},"liveStreams":{},"playlistItems":{},"playlists":{},"search":{},"subscriptions":{},"thumbnails":{},"videoAbuseReportReasons":{},"videoCategories":{},"videos":{},"watermarks":{},"google":{"_options":{},"auth":{"_cachedCredential":null}}}
所以所有小的“子对象”都是空的。我该怎么解决这个问题?