Toggle navigation
Toggle navigation
This project
Loading...
Sign in
은승우
/
LINEBOT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
권은령
2019-12-04 23:28:28 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e46351916e1253eed4de474b2760e22c4eed9d83
e4635191
1 parent
8c965e70
error fixed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
app.js
mymusic.js
app.js
View file @
e463519
...
...
@@ -146,12 +146,12 @@ function handleEvent(event)
}
});
var
result
=
''
;
var
result
=
{
type
:
'text'
,
text
:
''
}
;
for
(
var
i
=
0
;
i
<
songList
.
length
;
i
++
)
{
result
+=
i
+
1
+
". "
+
songList
[
i
].
singer
+
" - "
+
songList
[
i
].
song
+
"\n"
;
result
.
text
+=
i
+
1
+
". "
+
songList
[
i
].
singer
+
" - "
+
songList
[
i
].
song
+
"\n"
;
}
console
.
log
(
result
);
console
.
log
(
result
.
text
);
});
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
).
catch
(
reject
);
});
...
...
mymusic.js
View file @
e463519
...
...
@@ -4,6 +4,7 @@ var request = require('request');
var
url
=
"https://www.genie.co.kr/chart/top200"
;
request
(
url
,
function
(
error
,
response
,
html
)
{
var
$
=
cheerio
.
load
(
html
);
...
...
@@ -52,7 +53,10 @@ request(url, function(error, response, html)
{
var
$
=
cheerio
.
load
(
html
);
var
lyric
=
$
(
'#pLyrics > p'
).
text
();
var
result
=
lyric
.
substring
(
0
,
150
);
console
.
log
(
songList
[
randnum
].
song
);
console
.
log
(
$
(
'#pLyrics > p'
).
text
()
);
console
.
log
(
result
);
});
})
\ No newline at end of file
...
...
Please
register
or
login
to post a comment