Showing
1 changed file
with
16 additions
and
2 deletions
... | @@ -10,7 +10,6 @@ const KOFIC_KEY = config.KOFIC_KEY; | ... | @@ -10,7 +10,6 @@ const KOFIC_KEY = config.KOFIC_KEY; |
10 | //============================================================= | 10 | //============================================================= |
11 | 11 | ||
12 | export function MovieInfo(replyToken, message) { | 12 | export function MovieInfo(replyToken, message) { |
13 | - | ||
14 | request.get( | 13 | request.get( |
15 | { | 14 | { |
16 | url: KOFIC_URL+`?key=${KOFIC_KEY}&movieCd=${message}`, | 15 | url: KOFIC_URL+`?key=${KOFIC_KEY}&movieCd=${message}`, |
... | @@ -19,6 +18,21 @@ export function MovieInfo(replyToken, message) { | ... | @@ -19,6 +18,21 @@ export function MovieInfo(replyToken, message) { |
19 | if(!error && response.statusCode == 200) { | 18 | if(!error && response.statusCode == 200) { |
20 | console.log(body.movieInfoResult); | 19 | console.log(body.movieInfoResult); |
21 | var MovieInfo = body.movieInfoResult.movieInfo; | 20 | var MovieInfo = body.movieInfoResult.movieInfo; |
21 | + var MovieName = MovieInfo.movieNm; | ||
22 | + var MovieDate = `${MovieInfo.openDt.slice(0,4)}년 ${MovieInfo.openDt.slice(4,6)}월 ${MovieInfo.openDt.slice(6,8)}일`; | ||
23 | + var MovieTime = MovieInfo.showTm; | ||
24 | + var MovieGenres = []; | ||
25 | + for(var i in MovieInfo.genres) | ||
26 | + { | ||
27 | + MovieGenres.push(MovieInfo.genres[i].genreNm); | ||
28 | + } | ||
29 | + var MovieDirec = MovieInfo.directors[0].peopleNm; | ||
30 | + var MovieActors = []; | ||
31 | + for(var i=0; i<MovieInfo.actors.length && i<5; i++) | ||
32 | + { | ||
33 | + MovieActors[i] = MovieInfo.actors[i].peopleNm; | ||
34 | + } | ||
35 | + | ||
22 | request.post( | 36 | request.post( |
23 | { | 37 | { |
24 | url: TARGET_URL, | 38 | url: TARGET_URL, |
... | @@ -30,7 +44,7 @@ export function MovieInfo(replyToken, message) { | ... | @@ -30,7 +44,7 @@ export function MovieInfo(replyToken, message) { |
30 | "messages":[ | 44 | "messages":[ |
31 | { | 45 | { |
32 | "type":"text", | 46 | "type":"text", |
33 | - "text":`영화명: ${MovieInfo.movieNm}\n개봉날짜: ${MovieInfo.prdtYear}\n상영시간: ${MovieInfo.showTm}분\n장르: ${MovieInfo.genres[0].genreNm}\n감독: ${MovieInfo.directors[0].peopleNm}\n출연배우: ${MovieInfo.actors[0].peopleNm},${MovieInfo.actors[1].peopleNm},${MovieInfo.actors[2].peopleNm},${MovieInfo.actors[3].peopleNm}` | 47 | + "text":`영화명: ${MovieName}\n개봉날짜: ${MovieDate}\n상영시간: ${MovieTime}분\n장르: ${MovieGenres}\n감독: ${MovieDirec}\n출연배우: ${MovieActors}` |
34 | } | 48 | } |
35 | ] | 49 | ] |
36 | } | 50 | } | ... | ... |
-
Please register or login to post a comment