Showing
1 changed file
with
21 additions
and
0 deletions
Youtube API/video_lists.js
0 → 100644
1 | +var {google} =require('googleapis'); | ||
2 | + | ||
3 | +var service = google.youtube('v3'); | ||
4 | +service.videos.list({ | ||
5 | + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518', | ||
6 | + part: 'snippet,statistics', | ||
7 | + id: 'p5iu1V30myk', // 동영상 Id | ||
8 | + fields: 'items(snippet(title))' | ||
9 | +}, function(err, response) { | ||
10 | + if (err) { | ||
11 | + console.log('The API returned an error: ',err); | ||
12 | + return; | ||
13 | + } | ||
14 | + | ||
15 | + var video =response.data.items; | ||
16 | + if(video.length ==0){ | ||
17 | + console.log('검색된 동영상이 없습니다.'); | ||
18 | + } else { | ||
19 | + console.log(JSON.stringify(response.data.items[0],null,4)); | ||
20 | + } | ||
21 | +}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment