권은령

apply getting lyric from songList

......@@ -101,6 +101,8 @@ if(e) console.log('ERROR:', e);
*/
var songList=[]; // list to store music(singer, song, lyric url)
app.post('/webhook', line.middleware(config), (req, res) => {
Promise
......@@ -125,7 +127,6 @@ function handleEvent(event)
request(url, function(error, response, html){
var $ = cheerio.load(html);
var songList=[];
const $bodyList= $('#body-content > div.newest-list > div > table > tbody > tr');
$bodyList.each(function(i, elem){
......@@ -157,6 +158,16 @@ function handleEvent(event)
});
});
}
else if(event.message.text.substring(0, 7)=='가사 검색 1')
{
return new Promise(function(resolve, reject)
{
var result = { type: 'text', text:''};
result.text=songList[1].url;
client.replyMessage(event.replyToken, result).then(resolve).catch(reject);
}
}
else
{
return new Promise(function(resolve, reject)
......
......@@ -3,14 +3,11 @@ var request = require('request');
var url="https://www.genie.co.kr/chart/top200";
var songList=[];
request(url, function(error, response, html)
{
var $ = cheerio.load(html);
var songList=[];
const $bodyList= $('#body-content > div.newest-list > div > table > tbody > tr');
console.log($bodyList.length);
......