【发布时间】:2016-06-02 13:05:48
【问题描述】:
我使用npm install googleapis 下载并安装了google api,现在我正在尝试使用以下代码访问我的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}}}
所以所有的小“子对象”都是空的。我该如何解决这个问题?
【问题讨论】:
-
更新:以这种方式所有的api都是空的。我试过
urlshortener,同样的问题仍然存在。
标签: javascript node.js youtube youtube-data-api google-api-nodejs-client