【发布时间】:2016-05-24 14:47:05
【问题描述】:
我正在尝试让youtube.search.list 与Node.js 一起工作。看起来我可以使用YouTube API v.3.0 成功进行身份验证,但是当我运行youtube.search.list 时,我得到了空结果集。
代码中有愚蠢的错误,或者我在YouTube API 上提出了错误的请求。
代码如下:
var google = require('googleapis');
var youtubeV3 = google.youtube({ version: 'v3', auth: 'MY_API_KEY' });
var request = youtubeV3.search.list({
part: 'snippet',
type: 'video',
q: 'Cat',
maxResults: 50,
order: 'date',
safeSearch: 'moderate',
videoEmbeddable: true
});
// console.log('Here we start search');
for (var i in request.items) {
var item = request.items[i];
console.log('Title: ', item.id.videoId, item.snippet.title);
}
为了检查我从 API 返回的内容,我运行 console.log(request) 并获取空对象。
【问题讨论】:
-
我没有这方面的经验,但我会检查 developers.google.com/youtube/v3/code_samples/… 我认为在获得结果之前应该有一个 execute(),祝你好运,如果你得到它的工作,请报告。
-
@diynevala,我在您引用的资源上花了很多钱,但没有积极的结果
标签: javascript node.js youtube-api