이진아

연재완료 연도별 다음 웹툰

...@@ -275,12 +275,49 @@ function getAllToons() { ...@@ -275,12 +275,49 @@ function getAllToons() {
275 allWebtoons = allWebtoonList; 275 allWebtoons = allWebtoonList;
276 }; 276 };
277 277
278 +
279 +allWebtoons2 = new Array();
280 +
281 +
282 +
283 +function getAllToons2() {
284 + allWebtoonList2 = new Array();
285 +//연재 완료 연도별 다음 웹툰
286 + var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_finished/?genre_id=&timeStamp=1575275921086';
287 + var site = 'daum';
288 + client.fetch(daum, {}, function (err, $, res, body) {
289 + var data = JSON.parse(body);
290 + var list = data["data"];
291 + list.forEach(function (item, idx) {
292 + var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
293 + var yyyy = (item.finishDate).substring(0,4)
294 +
295 + var webtoon = {
296 + name: item.title,
297 + thum_link: item.pcThumbnailImage.url,
298 + webtoon_link: webtoon_link,
299 + year : yyyy
300 +
301 + }
302 + allWebtoonList2.push(webtoon);
303 + });
304 +
305 + });
306 + allWebtoons2 = allWebtoonList2;
307 +}
308 +
278 getAllToons(); 309 getAllToons();
279 //처음 한번 수행 310 //처음 한번 수행
280 setInterval(getAllToons,5*60*1000); 311 setInterval(getAllToons,5*60*1000);
281 //5분에 한번 수행 312 //5분에 한번 수행
282 313
314 +getAllToons2();
315 +setInterval(getAllToons2,5*60*1000);
316 +
317 +
283 /* GET home page. */ 318 /* GET home page. */
319 +
320 +//진아 : list :allWebtoons2 해도 되는지??!!
284 router.get('/', 321 router.get('/',
285 function(req,res,next){ 322 function(req,res,next){
286 if(req.isAuthenticated()){ 323 if(req.isAuthenticated()){
...@@ -291,6 +328,7 @@ router.get('/', ...@@ -291,6 +328,7 @@ router.get('/',
291 res.render('index',{ 328 res.render('index',{
292 title: "니툰내툰", 329 title: "니툰내툰",
293 list: allWebtoons 330 list: allWebtoons
331 + list: allWebtoons2
294 }); 332 });
295 } 333 }
296 }); 334 });
......