나혜원

update youtube.js

var response = 'IU';
var request = require("request");
var request = require('request');
var cheerio = require('cheerio');
var options = { method: 'GET',
url: 'https://www.googleapis.com/youtube/v3/search',
qs:
{ key: 'AIzaSyA8-HR7V5cGIwWiBUWzKZsm5yzwrYc-4ys',
part: 'snippet',
part: 'id',
maxResults: '1',
order: 'viewCount',
q: response,
type: 'video' },
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
request(options, function(error,result,body){
if(error) throw new Error(error);
console.log(body);
var temp = body.replace('{','');
var temp1 = temp.split('\n');
console.log(temp1);
});
\ No newline at end of file
......