Showing
3 changed files
with
39 additions
and
5 deletions
... | @@ -154,6 +154,35 @@ function getLatestToon(titleid, day ,cb) { | ... | @@ -154,6 +154,35 @@ function getLatestToon(titleid, day ,cb) { |
154 | 154 | ||
155 | var daumCount = 0; | 155 | var daumCount = 0; |
156 | 156 | ||
157 | + | ||
158 | +// Shows Top-10 webtoons | ||
159 | +function gettop(){ | ||
160 | + var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_daily_ranking/serialized?timeStamp=1559440437553'; | ||
161 | + var site = 'daum'; | ||
162 | + | ||
163 | + client.fetch(daum, {}, function (err, $, res, body){ | ||
164 | + | ||
165 | + var data = JSON.parse(body); | ||
166 | + var list = data['data']; | ||
167 | + | ||
168 | + list.forEach(function(item, idx){ | ||
169 | + var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); | ||
170 | + var webtoon = { | ||
171 | + toon_index : item.id, | ||
172 | + name : item.title, | ||
173 | + thum_link : item.pcThumbnailImage.url, | ||
174 | + webtoon_link : webtoon_link, | ||
175 | + week : "TOP-10", | ||
176 | + site : site, | ||
177 | + lates : item.latestWebtoonEpisode.episode | ||
178 | + } | ||
179 | + allWebtoonList.push(webtoon); | ||
180 | + }); | ||
181 | + }); | ||
182 | +}; | ||
183 | + | ||
184 | + | ||
185 | + | ||
157 | //_day요일의 다음웹툰 불러오기 | 186 | //_day요일의 다음웹툰 불러오기 |
158 | function getDaumToons(_day) { | 187 | function getDaumToons(_day) { |
159 | 188 | ||
... | @@ -180,7 +209,8 @@ function getDaumToons(_day) { | ... | @@ -180,7 +209,8 @@ function getDaumToons(_day) { |
180 | webtoon_link : webtoon_link, | 209 | webtoon_link : webtoon_link, |
181 | week : day_name, | 210 | week : day_name, |
182 | site : site, | 211 | site : site, |
183 | - latest : 0 | 212 | + latest : item.latestWebtoonEpisode.episode, |
213 | + averageScore : item.webtoonServices.averageScore | ||
184 | }; | 214 | }; |
185 | daumCount++; | 215 | daumCount++; |
186 | allWebtoonList.push(webtoon); | 216 | allWebtoonList.push(webtoon); |
... | @@ -216,7 +246,8 @@ function getNaverToons() { | ... | @@ -216,7 +246,8 @@ function getNaverToons() { |
216 | webtoon_link : webtoon_link, | 246 | webtoon_link : webtoon_link, |
217 | week : week, | 247 | week : week, |
218 | site : site, | 248 | site : site, |
219 | - latest : 0 | 249 | + latest : 0, |
250 | + averageScore : 0 | ||
220 | }; | 251 | }; |
221 | naverCount++; | 252 | naverCount++; |
222 | allWebtoonList.push(webtoon); | 253 | allWebtoonList.push(webtoon); |
... | @@ -265,6 +296,8 @@ function getAllToons() { | ... | @@ -265,6 +296,8 @@ function getAllToons() { |
265 | getDaumToons('sat'); | 296 | getDaumToons('sat'); |
266 | //일요일 다음 웹툰 | 297 | //일요일 다음 웹툰 |
267 | getDaumToons('sun'); | 298 | getDaumToons('sun'); |
299 | + //Top10 | ||
300 | + gettop() | ||
268 | //네이버 웹툰 | 301 | //네이버 웹툰 |
269 | getNaverToons(); | 302 | getNaverToons(); |
270 | 303 | ... | ... |
... | @@ -2,7 +2,7 @@ var express = require('express'); | ... | @@ -2,7 +2,7 @@ var express = require('express'); |
2 | var router = express.Router(); | 2 | var router = express.Router(); |
3 | 3 | ||
4 | function addMyToons(id,index,cb){ | 4 | function addMyToons(id,index,cb){ |
5 | - connection.query("INSERT INTO user_toon_relation SET ?;", {user_id : id,toon_index : index},function (err) { | 5 | + connection.query("INSERT INTO user_toon_relation SET ?;", {user_id : id, toon_index : index},function (err) { |
6 | 6 | ||
7 | if(err) { | 7 | if(err) { |
8 | throw err; | 8 | throw err; | ... | ... |
... | @@ -35,14 +35,15 @@ CREATE TABLE `toon` ( | ... | @@ -35,14 +35,15 @@ CREATE TABLE `toon` ( |
35 | `webtoon_link` varchar(225) DEFAULT NULL, | 35 | `webtoon_link` varchar(225) DEFAULT NULL, |
36 | `site` varchar(45) DEFAULT NULL, | 36 | `site` varchar(45) DEFAULT NULL, |
37 | `week` varchar(45) DEFAULT NULL, | 37 | `week` varchar(45) DEFAULT NULL, |
38 | - `latest` int(11) DEFAULT NULL | 38 | + `latest` int(11) DEFAULT NULL, |
39 | + `averageScore` FLOAT(23.11) DEFAULT NULL | ||
39 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 40 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
40 | 41 | ||
41 | -- | 42 | -- |
42 | -- 테이블의 덤프 데이터 `toon` | 43 | -- 테이블의 덤프 데이터 `toon` |
43 | -- | 44 | -- |
44 | 45 | ||
45 | -INSERT INTO `toon` (`toon_index`, `name`, `thum_link`, `webtoon_link`, `site`, `week`, `latest`) VALUES | 46 | +INSERT INTO `toon` (`toon_index`, `name`, `thum_link`, `webtoon_link`, `site`, `week`, `latest`,`averageScore`) VALUES |
46 | (194, '대작 (2010)', 'http://i1.cartoon.daumcdn.net/svc/image/U03/cartoon/55277C7D043EDE0001', 'http://webtoon.daum.net/webtoon/view/drinkingtogether', 'daum', 'FRI', 0), | 47 | (194, '대작 (2010)', 'http://i1.cartoon.daumcdn.net/svc/image/U03/cartoon/55277C7D043EDE0001', 'http://webtoon.daum.net/webtoon/view/drinkingtogether', 'daum', 'FRI', 0), |
47 | (553, '어쿠스틱 라이프', 'http://i1.cartoon.daumcdn.net/svc/image/U03/cartoon/55277772023D470003', 'http://webtoon.daum.net/webtoon/view/acoustic', 'daum', 'FRI', 0), | 48 | (553, '어쿠스틱 라이프', 'http://i1.cartoon.daumcdn.net/svc/image/U03/cartoon/55277772023D470003', 'http://webtoon.daum.net/webtoon/view/acoustic', 'daum', 'FRI', 0), |
48 | (783, '창백한 말', 'http://t1.daumcdn.net/webtoon/op/86943651213dd579461e3c356e41889909ff8a08', 'http://webtoon.daum.net/webtoon/view/palehorse', 'daum', 'WED', 0), | 49 | (783, '창백한 말', 'http://t1.daumcdn.net/webtoon/op/86943651213dd579461e3c356e41889909ff8a08', 'http://webtoon.daum.net/webtoon/view/palehorse', 'daum', 'WED', 0), | ... | ... |
-
Please register or login to post a comment