이진아

네이버 영화-현재 좋아요, 현재 예매, 예정 기대지수, 예정 예매

...@@ -277,11 +277,10 @@ function getAllToons() { ...@@ -277,11 +277,10 @@ function getAllToons() {
277 allWebtoons = allWebtoonList; 277 allWebtoons = allWebtoonList;
278 }; 278 };
279 279
280 +//---------------------------------------------------------------------------------------------------------------------
280 281
281 allWebtoons2 = new Array(); 282 allWebtoons2 = new Array();
282 283
283 -
284 -
285 function getAllToons2() { 284 function getAllToons2() {
286 allWebtoonList2 = new Array(); 285 allWebtoonList2 = new Array();
287 //연재 완료 연도별 다음 웹툰 286 //연재 완료 연도별 다음 웹툰
...@@ -307,7 +306,7 @@ function getAllToons2() { ...@@ -307,7 +306,7 @@ function getAllToons2() {
307 }); 306 });
308 allWebtoons2 = allWebtoonList2; 307 allWebtoons2 = allWebtoonList2;
309 } 308 }
310 - 309 +//---------------------------------------------------------------------------------------------------------------------
311 allWebtoons3 = new Array(); 310 allWebtoons3 = new Array();
312 311
313 function getAllToons3(){ 312 function getAllToons3(){
...@@ -671,10 +670,111 @@ function getAllToons3(){ ...@@ -671,10 +670,111 @@ function getAllToons3(){
671 //console.log(allWebtoonList3) 670 //console.log(allWebtoonList3)
672 } 671 }
673 }, (error) => console.log(error)); 672 }, (error) => console.log(error));
674 - 673 +
675 allWebtoons3 = allWebtoonList3; 674 allWebtoons3 = allWebtoonList3;
676 } 675 }
677 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 +
777 +
678 getAllToons(); 778 getAllToons();
679 //처음 한번 수행 779 //처음 한번 수행
680 setInterval(getAllToons,5*60*1000); 780 setInterval(getAllToons,5*60*1000);
...@@ -686,6 +786,9 @@ setInterval(getAllToons2,5*60*1000); ...@@ -686,6 +786,9 @@ setInterval(getAllToons2,5*60*1000);
686 getAllToons3(); 786 getAllToons3();
687 setInterval(getAllToons3,5*60*1000); 787 setInterval(getAllToons3,5*60*1000);
688 788
789 +getAllToons4();
790 +setInterval(getAllToons4,5*60*1000);
791 +
689 /* GET home page. */ 792 /* GET home page. */
690 793
691 //진아 : list :allWebtoons2.3 해도 되는지??!! 794 //진아 : list :allWebtoons2.3 해도 되는지??!!
...@@ -701,6 +804,7 @@ router.get('/', ...@@ -701,6 +804,7 @@ router.get('/',
701 list: allWebtoons 804 list: allWebtoons
702 list: allWebtoons2 805 list: allWebtoons2
703 list: allWebtoons3 806 list: allWebtoons3
807 + list: allWebtoons4
704 }); 808 });
705 } 809 }
706 }); 810 });
......