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

//1
var service = google.youtube('v3');
service.videos.list({
    key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
    part: 'snippet',
    id: 'p5iu1V30myk', // 동영상 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: 'i-SBnhaZSSU', // 동영상 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: 'Etfgb6A7hSI', // 동영상 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: 'IN2mml9xs_s', // 동영상 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: 'tp1uoFAfgHE', // 동영상 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: 'Qx22TnVVIfU', // 동영상 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: '3y1QIqR115A', // 동영상 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: 'VXBI1wt8XII', // 동영상 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: 'aWMBn2--E0Q', // 동영상 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: 'HyTbgBlnLCo', // 동영상 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));
    }
})