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-05 00:10:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3bbe5e327b5f18de61032070bc5a58be5791d610
3bbe5e32
1 parent
1d738eea
apply getting lyric from songList
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
app.js
mymusic.js
app.js
View file @
3bbe5e3
...
...
@@ -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
)
...
...
mymusic.js
View file @
3bbe5e3
...
...
@@ -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
);
...
...
Please
register
or
login
to post a comment