Showing
1 changed file
with
2 additions
and
4 deletions
... | @@ -99,15 +99,13 @@ async function handleEvent(event) { | ... | @@ -99,15 +99,13 @@ async function handleEvent(event) { |
99 | }; | 99 | }; |
100 | 100 | ||
101 | request.post(options, function (error, response, body) { | 101 | request.post(options, function (error, response, body) { |
102 | - var data=body; | 102 | + let jsonResponse = JSON.stringify(JSON.parse(body), null, ' '); |
103 | - console.log(data); | ||
104 | var text=''; | 103 | var text=''; |
105 | - while(data.indexOf('text\\')!=-1) | 104 | + while(jsonResponse.indexOf('text\\')!=-1) |
106 | { | 105 | { |
107 | data=data.substring(data.indexOf('text\\')+9); | 106 | data=data.substring(data.indexOf('text\\')+9); |
108 | text+=data.substring(0,data.indexOf("\\"))+" "; | 107 | text+=data.substring(0,data.indexOf("\\"))+" "; |
109 | } | 108 | } |
110 | - text="나의모든날들"; | ||
111 | var url="https://www.genie.co.kr/search/searchLyrics?query="+ encodeURI(text); | 109 | var url="https://www.genie.co.kr/search/searchLyrics?query="+ encodeURI(text); |
112 | request(url, function(error, response, html){ | 110 | request(url, function(error, response, html){ |
113 | var $ = cheerio.load(html); | 111 | var $ = cheerio.load(html); | ... | ... |
-
Please register or login to post a comment