이진아

파일분리!

...@@ -277,502 +277,6 @@ function getAllToons() { ...@@ -277,502 +277,6 @@ function getAllToons() {
277 allWebtoons = allWebtoonList; 277 allWebtoons = allWebtoonList;
278 }; 278 };
279 279
280 -//---------------------------------------------------------------------------------------------------------------------
281 -
282 -allWebtoons2 = new Array();
283 -
284 -function getAllToons2() {
285 - allWebtoonList2 = new Array();
286 -//연재 완료 연도별 다음 웹툰
287 - var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_finished/?genre_id=&timeStamp=1575275921086';
288 - var site = 'daum';
289 - client.fetch(daum, {}, function (err, $, res, body) {
290 - var data = JSON.parse(body);
291 - var list = data["data"];
292 - list.forEach(function (item, idx) {
293 - var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
294 - var yyyy = (item.finishDate).substring(0,4)
295 -
296 - var webtoon = {
297 - name: item.title,
298 - thum_link: item.pcThumbnailImage.url,
299 - webtoon_link: webtoon_link,
300 - year : yyyy
301 -
302 - }
303 - allWebtoonList2.push(webtoon);
304 - });
305 -
306 - });
307 - allWebtoons2 = allWebtoonList2;
308 -}
309 -//---------------------------------------------------------------------------------------------------------------------
310 -allWebtoons3 = new Array();
311 -
312 -function getAllToons3(){
313 - allWebtoonList3 = new Array();
314 -
315 - //2019년 연재 네이버 웹툰
316 - const naver2019 = 'https://comic.naver.com/webtoon/period.nhn?period=2019';
317 -
318 - axios.get(naver2019).then(res => {
319 - if (res.status === 200) {
320 - let naver2019 = [];
321 - const $ = cheerio.load(res.data);
322 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
323 - var tn = 2019;
324 - $toonList.each(function (i) {
325 - naver2019[i] = {
326 - title: $(this).find('dl > dt > a').text(),
327 - img: $(this).find('div > a > img').attr('src'),
328 - index: $(this).find('li > div > a').attr('href'),
329 - year : tn
330 - };
331 - });
332 -
333 - const data = naver2019.filter(m => m.title);
334 - allWebtoonList3.push(data);
335 - //console.log(allWebtoonList3)
336 - }
337 - }, (error) => console.log(error));
338 -
339 - //2018년 연재 네이버 웹툰
340 - const naver2018 = 'https://comic.naver.com/webtoon/period.nhn?period=2018';
341 -
342 - axios.get(naver2018).then(res => {
343 - if (res.status === 200) {
344 - let naver2018 = [];
345 - const $ = cheerio.load(res.data);
346 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
347 - var tn = 2018;
348 - $toonList.each(function (i) {
349 - naver2018[i] = {
350 - title: $(this).find('dl > dt > a').text(),
351 - img: $(this).find('div > a > img').attr('src'),
352 - index: $(this).find('li > div > a').attr('href'),
353 - year : tn
354 - };
355 - });
356 -
357 - const data = naver2018.filter(m => m.title);
358 - allWebtoonList3.push(data);
359 - //console.log(allWebtoonList3)
360 - }
361 - }, (error) => console.log(error));
362 -
363 - //2017년 연재 네이버 웹툰
364 - const naver2017 = 'https://comic.naver.com/webtoon/period.nhn?period=2017';
365 -
366 - axios.get(naver2017).then(res => {
367 - if (res.status === 200) {
368 - let naver2017 = [];
369 - const $ = cheerio.load(res.data);
370 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
371 - var tn = 2017;
372 - $toonList.each(function (i) {
373 - naver2017[i] = {
374 - title: $(this).find('dl > dt > a').text(),
375 - img: $(this).find('div > a > img').attr('src'),
376 - index: $(this).find('li > div > a').attr('href'),
377 - year : tn
378 - };
379 - });
380 -
381 - const data = naver2017.filter(m => m.title);
382 - allWebtoonList3.push(data);
383 - //console.log(allWebtoonList3)
384 - }
385 - }, (error) => console.log(error));
386 -
387 - //2016년 연재 네이버 웹툰
388 - const naver2016 = 'https://comic.naver.com/webtoon/period.nhn?period=2016';
389 -
390 - axios.get(naver2016).then(res => {
391 - if (res.status === 200) {
392 - let naver2016 = [];
393 - const $ = cheerio.load(res.data);
394 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
395 - var tn = 2016;
396 - $toonList.each(function (i) {
397 - naver2016[i] = {
398 - title: $(this).find('dl > dt > a').text(),
399 - img: $(this).find('div > a > img').attr('src'),
400 - index: $(this).find('li > div > a').attr('href'),
401 - year : tn
402 - };
403 - });
404 -
405 - const data = naver2016.filter(m => m.title);
406 - allWebtoonList3.push(data);
407 - //console.log(allWebtoonList3)
408 - }
409 - }, (error) => console.log(error));
410 -
411 - //2015년 연재 네이버 웹툰
412 - const naver2015 = 'https://comic.naver.com/webtoon/period.nhn?period=2015';
413 -
414 - axios.get(naver2015).then(res => {
415 - if (res.status === 200) {
416 - let naver2015 = [];
417 - const $ = cheerio.load(res.data);
418 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
419 - var tn = 2015;
420 - $toonList.each(function (i) {
421 - naver2015[i] = {
422 - title: $(this).find('dl > dt > a').text(),
423 - img: $(this).find('div > a > img').attr('src'),
424 - index: $(this).find('li > div > a').attr('href'),
425 - year : tn
426 - };
427 - });
428 -
429 - const data = naver2015.filter(m => m.title);
430 - allWebtoonList3.push(data);
431 - //console.log(allWebtoonList3)
432 - }
433 - }, (error) => console.log(error));
434 -//2014년 연재 네이버 웹툰
435 - const naver2014 = 'https://comic.naver.com/webtoon/period.nhn?period=2014';
436 -
437 - axios.get(naver2014).then(res => {
438 - if (res.status === 200) {
439 - let naver2014 = [];
440 - const $ = cheerio.load(res.data);
441 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
442 - var tn = 2014;
443 - $toonList.each(function (i) {
444 - naver2014[i] = {
445 - title: $(this).find('dl > dt > a').text(),
446 - img: $(this).find('div > a > img').attr('src'),
447 - index: $(this).find('li > div > a').attr('href'),
448 - year : tn
449 - };
450 - });
451 -
452 - const data = naver2014.filter(m => m.title);
453 - allWebtoonList3.push(data);
454 - //console.log(allWebtoonList3)
455 - }
456 - }, (error) => console.log(error));
457 -
458 -//2013년 연재 네이버 웹툰
459 - const naver2013 = 'https://comic.naver.com/webtoon/period.nhn?period=2013';
460 -
461 - axios.get(naver2013).then(res => {
462 - if (res.status === 200) {
463 - let naver2013 = [];
464 - const $ = cheerio.load(res.data);
465 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
466 - var tn = 2013;
467 - $toonList.each(function (i) {
468 - naver2013[i] = {
469 - title: $(this).find('dl > dt > a').text(),
470 - img: $(this).find('div > a > img').attr('src'),
471 - index: $(this).find('li > div > a').attr('href'),
472 - year : tn
473 - };
474 - });
475 -
476 - const data = naver2013.filter(m => m.title);
477 - allWebtoonList3.push(data);
478 - //console.log(allWebtoonList3)
479 - }
480 - }, (error) => console.log(error));
481 -
482 -//2012년 연재 네이버 웹툰
483 - const naver2012 = 'https://comic.naver.com/webtoon/period.nhn?period=2012';
484 -
485 - axios.get(naver2012).then(res => {
486 - if (res.status === 200) {
487 - let naver2012 = [];
488 - const $ = cheerio.load(res.data);
489 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
490 - var tn = 2012;
491 - $toonList.each(function (i) {
492 - naver2012[i] = {
493 - title: $(this).find('dl > dt > a').text(),
494 - img: $(this).find('div > a > img').attr('src'),
495 - index: $(this).find('li > div > a').attr('href'),
496 - year : tn
497 - };
498 - });
499 -
500 - const data = naver2012.filter(m => m.title);
501 - allWebtoonList3.push(data);
502 - //console.log(allWebtoonList3)
503 - }
504 - }, (error) => console.log(error));
505 -
506 -//2011년 연재 네이버 웹툰
507 - const naver2011 = 'https://comic.naver.com/webtoon/period.nhn?period=2011';
508 -
509 - axios.get(naver2011).then(res => {
510 - if (res.status === 200) {
511 - let naver2011 = [];
512 - const $ = cheerio.load(res.data);
513 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
514 - var tn = 2011;
515 - $toonList.each(function (i) {
516 - naver2011[i] = {
517 - title: $(this).find('dl > dt > a').text(),
518 - img: $(this).find('div > a > img').attr('src'),
519 - index: $(this).find('li > div > a').attr('href'),
520 - year : tn
521 - };
522 - });
523 -
524 - const data = naver2011.filter(m => m.title);
525 - allWebtoonList3.push(data);
526 - //console.log(allWebtoonList3)
527 - }
528 - }, (error) => console.log(error));
529 -
530 -//2010년 연재 네이버 웹툰
531 - const naver2010 = 'https://comic.naver.com/webtoon/period.nhn?period=2010';
532 -
533 - axios.get(naver2010).then(res => {
534 - if (res.status === 200) {
535 - let naver2010 = [];
536 - const $ = cheerio.load(res.data);
537 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
538 - var tn = 2010;
539 - $toonList.each(function (i) {
540 - naver2010[i] = {
541 - title: $(this).find('dl > dt > a').text(),
542 - img: $(this).find('div > a > img').attr('src'),
543 - index: $(this).find('li > div > a').attr('href'),
544 - year : tn
545 - };
546 - });
547 -
548 - const data = naver2010.filter(m => m.title);
549 - allWebtoonList3.push(data);
550 - //console.log(allWebtoonList3)
551 - }
552 - }, (error) => console.log(error));
553 -
554 -//2009년 연재 네이버 웹툰
555 - const naver2009 = 'https://comic.naver.com/webtoon/period.nhn?period=2009';
556 -
557 - axios.get(naver2009).then(res => {
558 - if (res.status === 200) {
559 - let naver2009 = [];
560 - const $ = cheerio.load(res.data);
561 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
562 - var tn = 2009;
563 - $toonList.each(function (i) {
564 - naver2009[i] = {
565 - title: $(this).find('dl > dt > a').text(),
566 - img: $(this).find('div > a > img').attr('src'),
567 - index: $(this).find('li > div > a').attr('href'),
568 - year : tn
569 - };
570 - });
571 -
572 - const data = naver2009.filter(m => m.title);
573 - allWebtoonList3.push(data);
574 - //console.log(allWebtoonList3)
575 - }
576 - }, (error) => console.log(error));
577 -
578 -//2008년 연재 네이버 웹툰
579 - const naver2008 = 'https://comic.naver.com/webtoon/period.nhn?period=2008';
580 -
581 - axios.get(naver2008).then(res => {
582 - if (res.status === 200) {
583 - let naver2008 = [];
584 - const $ = cheerio.load(res.data);
585 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
586 - var tn = 2008;
587 - $toonList.each(function (i) {
588 - naver2008[i] = {
589 - title: $(this).find('dl > dt > a').text(),
590 - img: $(this).find('div > a > img').attr('src'),
591 - index: $(this).find('li > div > a').attr('href'),
592 - year : tn
593 - };
594 - });
595 -
596 - const data = naver2008.filter(m => m.title);
597 - allWebtoonList3.push(data);
598 - //console.log(allWebtoonList3)
599 - }
600 - }, (error) => console.log(error));
601 -
602 -//2007년 연재 네이버 웹툰
603 - const naver2007 = 'https://comic.naver.com/webtoon/period.nhn?period=2007';
604 -
605 - axios.get(naver2007).then(res => {
606 - if (res.status === 200) {
607 - let naver2007 = [];
608 - const $ = cheerio.load(res.data);
609 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
610 - var tn = 2007;
611 - $toonList.each(function (i) {
612 - naver2007[i] = {
613 - title: $(this).find('dl > dt > a').text(),
614 - img: $(this).find('div > a > img').attr('src'),
615 - index: $(this).find('li > div > a').attr('href'),
616 - year : tn
617 - };
618 - });
619 -
620 - const data = naver2007.filter(m => m.title);
621 - allWebtoonList3.push(data);
622 - //console.log(allWebtoonList3)
623 - }
624 - }, (error) => console.log(error));
625 -
626 -//2006년 연재 네이버 웹툰
627 - const naver2006 = 'https://comic.naver.com/webtoon/period.nhn?period=2006';
628 -
629 - axios.get(naver2006).then(res => {
630 - if (res.status === 200) {
631 - let naver2006 = [];
632 - const $ = cheerio.load(res.data);
633 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
634 - var tn = 2006;
635 - $toonList.each(function (i) {
636 - naver2006[i] = {
637 - title: $(this).find('dl > dt > a').text(),
638 - img: $(this).find('div > a > img').attr('src'),
639 - index: $(this).find('li > div > a').attr('href'),
640 - year : tn
641 - };
642 - });
643 -
644 - const data = naver2006.filter(m => m.title);
645 - allWebtoonList3.push(data);
646 - //console.log(allWebtoonList3)
647 - }
648 - }, (error) => console.log(error));
649 -
650 -//2005년 연재 네이버 웹툰
651 - const naver2005 = 'https://comic.naver.com/webtoon/period.nhn?period=2005';
652 -
653 - axios.get(naver2005).then(res => {
654 - if (res.status === 200) {
655 - let naver2005 = [];
656 - const $ = cheerio.load(res.data);
657 - const $toonList = $('#content > div.list_area.daily_img > ul > li');
658 - var tn = 2005;
659 - $toonList.each(function (i) {
660 - naver2005[i] = {
661 - title: $(this).find('dl > dt > a').text(),
662 - img: $(this).find('div > a > img').attr('src'),
663 - index: $(this).find('li > div > a').attr('href'),
664 - year : tn
665 - };
666 - });
667 -
668 - const data = naver2005.filter(m => m.title);
669 - allWebtoonList3.push(data);
670 - //console.log(allWebtoonList3)
671 - }
672 - }, (error) => console.log(error));
673 -
674 - allWebtoons3 = allWebtoonList3;
675 - }
676 -
677 -//--------------------------------------------------------------------------------------------------------
678 -
679 -allWebtoons4 = new Array();
680 -
681 -function getAllToons4() {
682 -
683 - allWebtoonList4 = new Array();
684 - //현재 상영작 좋아요 순
685 - const currentlikemovie = 'https://movie.naver.com/movie/running/current.nhn?view=list&tab=normal&order=likeCount';
686 -
687 - axios.get(currentlikemovie).then(res => {
688 - if (res.status === 200) {
689 - let currentLikeMovie = [];
690 - const $ = cheerio.load(res.data);
691 - const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
692 -
693 - $movieList.each(function (i) {
694 - currentLikeMovie[i] = {
695 - title: $(this).find('dt.tit a').text(),
696 - img: $(this).find('div.thumb img').attr('src')
697 - //개봉예정작에선 star가 없음
698 - //star: $(this).find('em.num_likeit').text().replace(/\t/gi, '').replace(/\n/gi,'')
699 - };
700 - });
701 -
702 - const data = currentLikeMovie.filter(m => m.title);
703 - allWebtoonList4.push(data);
704 - //console.log(data);
705 - }
706 - }, (error) => console.log(error));
707 -
708 - //현재 상영작 예매 순
709 - const runningreserve = 'https://movie.naver.com/movie/running/current.nhn?view=list&tab=normal&order=reserve';
710 -
711 - axios.get(runningreserve).then(res => {
712 - if (res.status === 200) {
713 - let crawledMovie = [];
714 - const $ = cheerio.load(res.data);
715 - const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
716 -
717 - $movieList.each(function (i) {
718 - crawledMovie[i] = {
719 - title: $(this).find('dt.tit a').text(),
720 - img: $(this).find('div.thumb img').attr('src')
721 - };
722 - });
723 -
724 - const data = crawledMovie.filter(m => m.title);
725 - allWebtoonList4.push(data);
726 - //console.log(data);
727 - }
728 - }, (error) => console.log(error));
729 -
730 - //개봉 예정영화 기대지수순
731 - const premovieinterest = 'https://movie.naver.com/movie/running/premovie.nhn?order=interestRate';
732 -
733 - axios.get(premovieinterest).then(res => {
734 - if (res.status === 200) {
735 - let crawledMovie = [];
736 - const $ = cheerio.load(res.data);
737 - const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
738 -
739 - $movieList.each(function (i) {
740 - crawledMovie[i] = {
741 - title: $(this).find('dt.tit a').text(),
742 - img: $(this).find('div.thumb img').attr('src')
743 - };
744 - });
745 -
746 - const data = crawledMovie.filter(m => m.title);
747 - allWebtoonList4.push(data);
748 - //console.log(data);
749 - }
750 - }, (error) => console.log(error));
751 -
752 - //계봉 예정영화 예매순
753 - const prereserve = 'https://movie.naver.com/movie/running/premovie.nhn?order=reserve';
754 -
755 - axios.get(prereserve).then(res => {
756 - if (res.status === 200) {
757 - let crawledMovie = [];
758 - const $ = cheerio.load(res.data);
759 - const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
760 -
761 - $movieList.each(function (i) {
762 - crawledMovie[i] = {
763 - title: $(this).find('dt.tit a').text(),
764 - img: $(this).find('div.thumb img').attr('src')
765 - };
766 - });
767 -
768 - const data = crawledMovie.filter(m => m.title);
769 - allWebtoonList4.push(data);
770 - //console.log(data);
771 - }
772 - }, (error) => console.log(error));
773 -
774 - allWebtoons4 = allWebtoonList4;
775 -}
776 280
777 281
778 getAllToons(); 282 getAllToons();
...@@ -780,18 +284,10 @@ getAllToons(); ...@@ -780,18 +284,10 @@ getAllToons();
780 setInterval(getAllToons,5*60*1000); 284 setInterval(getAllToons,5*60*1000);
781 //5분에 한번 수행 285 //5분에 한번 수행
782 286
783 -getAllToons2();
784 -setInterval(getAllToons2,5*60*1000);
785 -
786 -getAllToons3();
787 -setInterval(getAllToons3,5*60*1000);
788 -
789 -getAllToons4();
790 -setInterval(getAllToons4,5*60*1000);
791 287
792 /* GET home page. */ 288 /* GET home page. */
793 289
794 -//진아 : list :allWebtoons2.3 해도 되는지??!! 290 +
795 router.get('/', 291 router.get('/',
796 function(req,res,next){ 292 function(req,res,next){
797 if(req.isAuthenticated()){ 293 if(req.isAuthenticated()){
...@@ -802,9 +298,7 @@ router.get('/', ...@@ -802,9 +298,7 @@ router.get('/',
802 res.render('index',{ 298 res.render('index',{
803 title: "니툰내툰", 299 title: "니툰내툰",
804 list: allWebtoons 300 list: allWebtoons
805 - list: allWebtoons2 301 +
806 - list: allWebtoons3
807 - list: allWebtoons4
808 }); 302 });
809 } 303 }
810 }); 304 });
......