Showing
1 changed file
with
6 additions
and
6 deletions
... | @@ -121,9 +121,6 @@ function handleEvent(event) | ... | @@ -121,9 +121,6 @@ function handleEvent(event) |
121 | else if(event.message.text.substring(0, 5)=='순위 보기') | 121 | else if(event.message.text.substring(0, 5)=='순위 보기') |
122 | { | 122 | { |
123 | // music list 출력 | 123 | // music list 출력 |
124 | - return new Promise(function(resolve, reject){ | ||
125 | - var result = { type: 'text', text:''}; | ||
126 | - | ||
127 | var url="https://www.genie.co.kr/chart/top200"; | 124 | var url="https://www.genie.co.kr/chart/top200"; |
128 | 125 | ||
129 | request(url, function(error, response, html){ | 126 | request(url, function(error, response, html){ |
... | @@ -131,8 +128,7 @@ function handleEvent(event) | ... | @@ -131,8 +128,7 @@ function handleEvent(event) |
131 | var songList=[]; | 128 | var songList=[]; |
132 | const $bodyList= $('#body-content > div.newest-list > div > table > tbody > tr'); | 129 | const $bodyList= $('#body-content > div.newest-list > div > table > tbody > tr'); |
133 | 130 | ||
134 | - $bodyList.each(function(i, elem) | 131 | + $bodyList.each(function(i, elem){ |
135 | - { | ||
136 | if(i<20) | 132 | if(i<20) |
137 | { | 133 | { |
138 | songList.push( | 134 | songList.push( |
... | @@ -147,13 +143,17 @@ function handleEvent(event) | ... | @@ -147,13 +143,17 @@ function handleEvent(event) |
147 | return; | 143 | return; |
148 | } | 144 | } |
149 | }); | 145 | }); |
146 | + }); | ||
147 | + | ||
148 | + return new Promise(function(resolve, reject) | ||
149 | + { | ||
150 | + var result = { type: 'text', text:''}; | ||
150 | 151 | ||
151 | for(var i=0; i<songList.length; i++) | 152 | for(var i=0; i<songList.length; i++) |
152 | { | 153 | { |
153 | result.text+=i+1 + ". "+ songList[i].singer+" - "+songList[i].song+"\n"; | 154 | result.text+=i+1 + ". "+ songList[i].singer+" - "+songList[i].song+"\n"; |
154 | } | 155 | } |
155 | console.log(result.text); | 156 | console.log(result.text); |
156 | - }); | ||
157 | client.replyMessage(event.replyToken, result).then(resolve).catch(reject); | 157 | client.replyMessage(event.replyToken, result).then(resolve).catch(reject); |
158 | }); | 158 | }); |
159 | } | 159 | } | ... | ... |
-
Please register or login to post a comment