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:58:05 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86e276177418a4d563d9f872d040869f456049e2
86e27617
1 parent
aab5ea33
fixing error...
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
app.js
app.js
View file @
86e2761
...
...
@@ -121,40 +121,40 @@ function handleEvent(event)
else
if
(
event
.
message
.
text
.
substring
(
0
,
5
)
==
'순위 보기'
)
{
// music list 출력
return
new
Promise
(
function
(
resolve
,
reject
){
var
result
=
{
type
:
'text'
,
text
:
''
};
var
url
=
"https://www.genie.co.kr/chart/top200"
;
var
url
=
"https://www.genie.co.kr/chart/top200"
;
request
(
url
,
function
(
error
,
response
,
html
){
var
$
=
cheerio
.
load
(
html
);
var
songList
=
[];
const
$bodyList
=
$
(
'#body-content > div.newest-list > div > table > tbody > tr'
);
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
)
$bodyList
.
each
(
function
(
i
,
elem
){
if
(
i
<
20
)
{
if
(
i
<
20
)
{
songList
.
push
(
{
singer
:
$
(
this
).
find
(
"td.info"
).
find
(
"a.artist.ellipsis"
).
text
().
trim
(),
song
:
$
(
this
).
find
(
"td.info"
).
find
(
"a.title.ellipsis"
).
text
().
trim
(),
url
:
'https://www.genie.co.kr/detail/songInfo?xgnm='
+
$
(
this
).
attr
(
"songid"
)
});
}
else
songList
.
push
(
{
return
;
}
});
singer
:
$
(
this
).
find
(
"td.info"
).
find
(
"a.artist.ellipsis"
).
text
().
trim
(),
song
:
$
(
this
).
find
(
"td.info"
).
find
(
"a.title.ellipsis"
).
text
().
trim
(),
url
:
'https://www.genie.co.kr/detail/songInfo?xgnm='
+
$
(
this
).
attr
(
"songid"
)
});
}
else
{
return
;
}
});
});
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
result
=
{
type
:
'text'
,
text
:
''
};
for
(
var
i
=
0
;
i
<
songList
.
length
;
i
++
)
{
result
.
text
+=
i
+
1
+
". "
+
songList
[
i
].
singer
+
" - "
+
songList
[
i
].
song
+
"\n"
;
}
console
.
log
(
result
.
text
);
});
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
).
catch
(
reject
);
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
).
catch
(
reject
);
});
}
else
...
...
Please
register
or
login
to post a comment