권은령

error fixed

...@@ -146,12 +146,12 @@ function handleEvent(event) ...@@ -146,12 +146,12 @@ function handleEvent(event)
146 } 146 }
147 }); 147 });
148 148
149 - var result=''; 149 + var result = { type: 'text', text:''};
150 for(var i=0; i<songList.length; i++) 150 for(var i=0; i<songList.length; i++)
151 { 151 {
152 - result+=i+1 + ". "+ songList[i].singer+" - "+songList[i].song+"\n"; 152 + result.text+=i+1 + ". "+ songList[i].singer+" - "+songList[i].song+"\n";
153 } 153 }
154 - console.log(result); 154 + console.log(result.text);
155 }); 155 });
156 client.replyMessage(event.replyToken, result).then(resolve).catch(reject); 156 client.replyMessage(event.replyToken, result).then(resolve).catch(reject);
157 }); 157 });
......
...@@ -4,6 +4,7 @@ var request = require('request'); ...@@ -4,6 +4,7 @@ var request = require('request');
4 var url="https://www.genie.co.kr/chart/top200"; 4 var url="https://www.genie.co.kr/chart/top200";
5 5
6 6
7 +
7 request(url, function(error, response, html) 8 request(url, function(error, response, html)
8 { 9 {
9 var $ = cheerio.load(html); 10 var $ = cheerio.load(html);
...@@ -52,7 +53,10 @@ request(url, function(error, response, html) ...@@ -52,7 +53,10 @@ request(url, function(error, response, html)
52 { 53 {
53 var $ = cheerio.load(html); 54 var $ = cheerio.load(html);
54 55
56 + var lyric=$('#pLyrics > p').text();
57 + var result=lyric.substring(0, 150);
58 +
55 console.log(songList[randnum].song); 59 console.log(songList[randnum].song);
56 - console.log($('#pLyrics > p').text()); 60 + console.log(result);
57 }); 61 });
58 }) 62 })
...\ No newline at end of file ...\ No newline at end of file
......