video_list_exciting.js 5.05 KB
var {google} =require('googleapis');

//1
var service = google.youtube('v3');
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'j-seAiANLG8', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//2
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'F8c8f2nK82w', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//3
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'IfemyZEhfpY', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//4
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: '86suvlS1pGM', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//5
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'ztmOmJrTF5c', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//6
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: '6jAHysZVtwI', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//7
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'fFZ1__X-kKs', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//8
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'ei0k_1Uro-U', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//9
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'mCtVrf2x5BQ', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})
//10
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'FV003QMWhNM', // 동영상 Id
    fields: 'items(snippet(title))'
}, function(err, response) {
    if (err) {
        console.log('The API returned an error: ',err);
        return;
    }

    var video =response.data.items;
    if(video.length ==0){
        console.log('검색된 동영상이 없습니다.');
    } else {
        console.log(JSON.stringify(response.data.items[0],null,4));
    }
})