Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Chat_Bot
/
KaKao_ChatBot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
윤준현
2018-12-05 21:21:21 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
042e291c375067ebaf1d0bdf0c241bd3405260d0
042e291c
1 parent
c9b14db2
add_Mot_guckkasten_Success
ggg
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
139 additions
and
20 deletions
app.js
crawling/Guckkasten.js
app.js
View file @
042e291
...
...
@@ -9,6 +9,9 @@ var async = require('async');
var
crawlReol
=
require
(
'./crawling/Reol'
);
var
crawlYonezu
=
require
(
'./crawling/Yonezu'
);
var
crawlYorusika
=
require
(
'./crawling/Yorusika'
);
var
crawlGuckkasten
=
require
(
'./crawling/Guckkasten'
);
var
crawlMot
=
require
(
'./crawling/Mot'
);
var
singer
;
//body-parser 미들웨어 사용
...
...
@@ -57,6 +60,19 @@ app.post('/message', function(req,res){
callback
(
null
,
yorusika
);
});
break
;
case
'Guckkasten-Discography'
:
singer
=
'guckkasten'
;
crawlGuckkasten
.
crawl_guckkasten
(
function
(
guckkasten
)
{
callback
(
null
,
guckkasten
);
});
break
;
case
'Mot-Discography'
:
singer
=
'mot'
;
crawlMot
.
crawl_mot
(
function
(
mot
)
{
callback
(
null
,
mot
);
});
break
;
default
:
if
(
singer
==
'Reol'
){
crawlReol
.
crawl_Reol
(
'https://namu.wiki/w/%EB%A0%88%EC%98%A4%EB%A3%A8/%EC%9D%8C%EB%B0%98#toc'
,
function
(
Reol
){
...
...
@@ -73,6 +89,16 @@ app.post('/message', function(req,res){
callback
(
null
,
yorusika
);
});
}
else
if
(
singer
==
'guckkasten'
){
crawlGuckkasten
.
crawl_guckkasten
(
function
(
guckkasten
){
callback
(
null
,
guckkasten
);
});
}
else
if
(
singer
==
'mot'
){
crawlMot
.
crawl_mot
(
function
(
mot
)
{
callback
(
null
,
mot
);
});
}
else
callback
(
null
,
null
);
break
;
...
...
@@ -83,7 +109,12 @@ app.post('/message', function(req,res){
// 사용자의 msg를 받아 res를 보냄 //
function
(
discography
,
callback
){
var
index
=
parseInt
(
msg
[
0
])
-
1
;
var
index
;
if
(
msg
[
1
]
!=
'.'
){
index
=
parseInt
(
msg
[
0
])
*
10
+
parseInt
(
msg
[
1
])
-
1
;
}
else
index
=
parseInt
(
msg
[
0
])
-
1
;
switch
(
msg
)
{
case
'일본'
:
send
=
{
...
...
@@ -101,11 +132,11 @@ app.post('/message', function(req,res){
case
'한국'
:
send
=
{
'message'
:
{
'text'
:
'
미구현
'
'text'
:
'
등록된 가수 목록입니다.
'
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
[
'M
OT'
,
'Gukkasten'
,
'ZICO
'
]
'buttons'
:
[
'M
ot'
,
'Guckkasten
'
]
}
};
break
;
...
...
@@ -241,11 +272,77 @@ app.post('/message', function(req,res){
};
break
;
////////////////
// Guckkasten //
////////////////
case
'Guckkasten'
:
send
=
{
'message'
:
{
'text'
:
'설명 : 4인조 밴드\n멤버 :\n 하현우(Vocal, Guitar)\n 전규호(Guitar)\n 이정길(Drum)\n 김기범(Bass)\n장르 : 싸이키델릭 록\n데뷔 : 2007년\n소속사 : 인터파크'
,
'photo'
:
{
'url'
:
'http://ticketimage.interpark.com/interparkenter/guckkasten/about/guckkasten_about_pc_image(540x420px).jpg'
,
'width'
:
540
,
'height'
:
420
},
'message_button'
:
{
'label'
:
'공식 홈페이지'
,
'url'
:
"http://www.interparkenter.com/guckkasten/Main"
}
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
[
'Guckkasten-Discography'
]
}
};
break
;
case
'Guckkasten-Discography'
:
console
.
log
(
discography
[
0
].
json_album
);
send
=
{
'message'
:
{
'text'
:
'Album List'
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
discography
[
0
].
json_album
}
};
break
;
/////////////
//// M
OT
////
//// M
ot
////
/////////////
case
'Mot'
:
send
=
{
'message'
:
{
'text'
:
'설명 : 5인조 밴드\n현멤버(3집 이후) :\n 이이언(Vocal)\n 유웅렬(Guitar)\n 조남열(Drum)\n 송인섭(Bass)\n 이하윤(Keyboard)\n구멤버(1, 2집) :\n 이이언(Vocal)\n지이(Guitar)\n장르 : Indie Rock\n 데뷔 : 2007년\n소속사 : 인터파크'
,
'photo'
:
{
'url'
:
'https://scontent-icn1-1.xx.fbcdn.net/v/t1.0-1/p320x320/31164203_908165976030791_1214044515636084736_n.jpg?_nc_cat=111&_nc_ht=scontent-icn1-1.xx&oh=7da23be5eb9dfcd537287b012f231dbb&oe=5C9B33D0'
,
'width'
:
1000
,
'height'
:
677
},
'message_button'
:
{
'label'
:
'공식 Facebook'
,
'url'
:
"https://www.facebook.com/bandmot.official"
}
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
[
'Mot-Discography'
]
}
};
break
;
case
'Mot-Discography'
:
send
=
{
'message'
:
{
'text'
:
'Album List'
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
discography
[
0
].
json_album
}
};
break
;
// 앨범 정보 읽기 //
...
...
@@ -284,8 +381,30 @@ app.post('/message', function(req,res){
}
}
}
else
if
(
singer
==
'guckkasten'
){
send
=
{
'message'
:
{
'text'
:
album
+
'\n발매년도 : '
+
discography
[
0
].
json_year
[
index
]
+
'\n수록곡 : \n'
+
discography
[
0
].
json_track
[
index
]
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
[
'Guckkasten-Discography'
,
'초기화면'
]
}
}
}
else
if
(
singer
==
'mot'
){
send
=
{
'message'
:
{
'text'
:
album
+
'\n발매년도 : '
+
discography
[
0
].
json_year
[
index
]
+
'\n수록곡 : \n'
+
discography
[
0
].
json_track
[
index
]
},
keyboard
:
{
'type'
:
'buttons'
,
'buttons'
:
[
'Mot-Discography'
,
'초기화면'
]
}
}
}
break
;
// 초기 설정으로 돌아가기 //
case
'초기화면'
:
...
...
crawling/Guckkasten.js
View file @
042e291
...
...
@@ -4,30 +4,30 @@ var cheerio = require('cheerio');
function
crawl_guckkasten
(
callback
){
var
n
=
0
;
var
guckkasten
=
[];
crawl
(
function
(
album
,
year
,
track
){
crawl
(
function
(
json_album
,
json_year
,
json_
track
){
n
++
if
(
n
==
10
)
{
var
j
;
var
a
,
y
,
t
;
for
(
var
i
=
1
;
i
<
year
.
length
;
i
++
)
{
y
=
year
[
i
];
a
=
album
[
i
];
t
=
track
[
i
]
for
(
var
i
=
1
;
i
<
json_
year
.
length
;
i
++
)
{
y
=
json_
year
[
i
];
a
=
json_
album
[
i
];
t
=
json_
track
[
i
]
j
=
i
-
1
;
while
(
j
>=
0
&&
year
[
j
]
>
y
)
{
album
[
j
+
1
]
=
album
[
j
];
year
[
j
+
1
]
=
year
[
j
];
track
[
j
+
1
]
=
track
[
j
];
while
(
j
>=
0
&&
json_
year
[
j
]
>
y
)
{
json_album
[
j
+
1
]
=
json_
album
[
j
];
json_year
[
j
+
1
]
=
json_
year
[
j
];
json_track
[
j
+
1
]
=
json_
track
[
j
];
j
--
;
}
album
[
j
+
1
]
=
a
;
year
[
j
+
1
]
=
y
;
track
[
j
+
1
]
=
t
;
json_
album
[
j
+
1
]
=
a
;
json_
year
[
j
+
1
]
=
y
;
json_
track
[
j
+
1
]
=
t
;
}
for
(
var
i
=
0
;
i
<
album
.
length
;
i
++
){
album
[
i
]
=
(
i
+
1
)
+
'. '
+
album
[
i
];
for
(
var
i
=
0
;
i
<
json_
album
.
length
;
i
++
){
json_album
[
i
]
=
(
i
+
1
)
+
'. '
+
json_
album
[
i
];
}
guckkasten
.
push
(
album
,
year
,
track
);
guckkasten
.
push
(
{
json_album
,
json_year
,
json_track
}
);
callback
(
guckkasten
);
}
})
...
...
Please
register
or
login
to post a comment