은승우

Update app.js

Showing 1 changed file with 3 additions and 5 deletions
......@@ -99,15 +99,13 @@ async function handleEvent(event) {
};
request.post(options, function (error, response, body) {
var data=body;
console.log(data);
let jsonResponse = JSON.stringify(JSON.parse(body), null, ' ');
var text='';
while(data.indexOf('text\\')!=-1)
while(jsonResponse.indexOf('text\\')!=-1)
{
data=data.substring(data.indexOf('text\\')+9);
text+=data.substring(0,data.indexOf("\\"))+" ";
}
text="나의모든날들";
var url="https://www.genie.co.kr/search/searchLyrics?query="+ encodeURI(text);
request(url, function(error, response, html){
var $ = cheerio.load(html);
......@@ -132,7 +130,7 @@ async function handleEvent(event) {
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
});
});
});
}
......