이진아

파일분리!

......@@ -277,502 +277,6 @@ function getAllToons() {
allWebtoons = allWebtoonList;
};
//---------------------------------------------------------------------------------------------------------------------
allWebtoons2 = new Array();
function getAllToons2() {
allWebtoonList2 = new Array();
//연재 완료 연도별 다음 웹툰
var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_finished/?genre_id=&timeStamp=1575275921086';
var site = 'daum';
client.fetch(daum, {}, function (err, $, res, body) {
var data = JSON.parse(body);
var list = data["data"];
list.forEach(function (item, idx) {
var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
var yyyy = (item.finishDate).substring(0,4)
var webtoon = {
name: item.title,
thum_link: item.pcThumbnailImage.url,
webtoon_link: webtoon_link,
year : yyyy
}
allWebtoonList2.push(webtoon);
});
});
allWebtoons2 = allWebtoonList2;
}
//---------------------------------------------------------------------------------------------------------------------
allWebtoons3 = new Array();
function getAllToons3(){
allWebtoonList3 = new Array();
//2019년 연재 네이버 웹툰
const naver2019 = 'https://comic.naver.com/webtoon/period.nhn?period=2019';
axios.get(naver2019).then(res => {
if (res.status === 200) {
let naver2019 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2019;
$toonList.each(function (i) {
naver2019[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2019.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2018년 연재 네이버 웹툰
const naver2018 = 'https://comic.naver.com/webtoon/period.nhn?period=2018';
axios.get(naver2018).then(res => {
if (res.status === 200) {
let naver2018 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2018;
$toonList.each(function (i) {
naver2018[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2018.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2017년 연재 네이버 웹툰
const naver2017 = 'https://comic.naver.com/webtoon/period.nhn?period=2017';
axios.get(naver2017).then(res => {
if (res.status === 200) {
let naver2017 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2017;
$toonList.each(function (i) {
naver2017[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2017.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2016년 연재 네이버 웹툰
const naver2016 = 'https://comic.naver.com/webtoon/period.nhn?period=2016';
axios.get(naver2016).then(res => {
if (res.status === 200) {
let naver2016 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2016;
$toonList.each(function (i) {
naver2016[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2016.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2015년 연재 네이버 웹툰
const naver2015 = 'https://comic.naver.com/webtoon/period.nhn?period=2015';
axios.get(naver2015).then(res => {
if (res.status === 200) {
let naver2015 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2015;
$toonList.each(function (i) {
naver2015[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2015.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2014년 연재 네이버 웹툰
const naver2014 = 'https://comic.naver.com/webtoon/period.nhn?period=2014';
axios.get(naver2014).then(res => {
if (res.status === 200) {
let naver2014 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2014;
$toonList.each(function (i) {
naver2014[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2014.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2013년 연재 네이버 웹툰
const naver2013 = 'https://comic.naver.com/webtoon/period.nhn?period=2013';
axios.get(naver2013).then(res => {
if (res.status === 200) {
let naver2013 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2013;
$toonList.each(function (i) {
naver2013[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2013.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2012년 연재 네이버 웹툰
const naver2012 = 'https://comic.naver.com/webtoon/period.nhn?period=2012';
axios.get(naver2012).then(res => {
if (res.status === 200) {
let naver2012 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2012;
$toonList.each(function (i) {
naver2012[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2012.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2011년 연재 네이버 웹툰
const naver2011 = 'https://comic.naver.com/webtoon/period.nhn?period=2011';
axios.get(naver2011).then(res => {
if (res.status === 200) {
let naver2011 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2011;
$toonList.each(function (i) {
naver2011[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2011.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2010년 연재 네이버 웹툰
const naver2010 = 'https://comic.naver.com/webtoon/period.nhn?period=2010';
axios.get(naver2010).then(res => {
if (res.status === 200) {
let naver2010 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2010;
$toonList.each(function (i) {
naver2010[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2010.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2009년 연재 네이버 웹툰
const naver2009 = 'https://comic.naver.com/webtoon/period.nhn?period=2009';
axios.get(naver2009).then(res => {
if (res.status === 200) {
let naver2009 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2009;
$toonList.each(function (i) {
naver2009[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2009.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2008년 연재 네이버 웹툰
const naver2008 = 'https://comic.naver.com/webtoon/period.nhn?period=2008';
axios.get(naver2008).then(res => {
if (res.status === 200) {
let naver2008 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2008;
$toonList.each(function (i) {
naver2008[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2008.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2007년 연재 네이버 웹툰
const naver2007 = 'https://comic.naver.com/webtoon/period.nhn?period=2007';
axios.get(naver2007).then(res => {
if (res.status === 200) {
let naver2007 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2007;
$toonList.each(function (i) {
naver2007[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2007.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2006년 연재 네이버 웹툰
const naver2006 = 'https://comic.naver.com/webtoon/period.nhn?period=2006';
axios.get(naver2006).then(res => {
if (res.status === 200) {
let naver2006 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2006;
$toonList.each(function (i) {
naver2006[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2006.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
//2005년 연재 네이버 웹툰
const naver2005 = 'https://comic.naver.com/webtoon/period.nhn?period=2005';
axios.get(naver2005).then(res => {
if (res.status === 200) {
let naver2005 = [];
const $ = cheerio.load(res.data);
const $toonList = $('#content > div.list_area.daily_img > ul > li');
var tn = 2005;
$toonList.each(function (i) {
naver2005[i] = {
title: $(this).find('dl > dt > a').text(),
img: $(this).find('div > a > img').attr('src'),
index: $(this).find('li > div > a').attr('href'),
year : tn
};
});
const data = naver2005.filter(m => m.title);
allWebtoonList3.push(data);
//console.log(allWebtoonList3)
}
}, (error) => console.log(error));
allWebtoons3 = allWebtoonList3;
}
//--------------------------------------------------------------------------------------------------------
allWebtoons4 = new Array();
function getAllToons4() {
allWebtoonList4 = new Array();
//현재 상영작 좋아요 순
const currentlikemovie = 'https://movie.naver.com/movie/running/current.nhn?view=list&tab=normal&order=likeCount';
axios.get(currentlikemovie).then(res => {
if (res.status === 200) {
let currentLikeMovie = [];
const $ = cheerio.load(res.data);
const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
$movieList.each(function (i) {
currentLikeMovie[i] = {
title: $(this).find('dt.tit a').text(),
img: $(this).find('div.thumb img').attr('src')
//개봉예정작에선 star가 없음
//star: $(this).find('em.num_likeit').text().replace(/\t/gi, '').replace(/\n/gi,'')
};
});
const data = currentLikeMovie.filter(m => m.title);
allWebtoonList4.push(data);
//console.log(data);
}
}, (error) => console.log(error));
//현재 상영작 예매 순
const runningreserve = 'https://movie.naver.com/movie/running/current.nhn?view=list&tab=normal&order=reserve';
axios.get(runningreserve).then(res => {
if (res.status === 200) {
let crawledMovie = [];
const $ = cheerio.load(res.data);
const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
$movieList.each(function (i) {
crawledMovie[i] = {
title: $(this).find('dt.tit a').text(),
img: $(this).find('div.thumb img').attr('src')
};
});
const data = crawledMovie.filter(m => m.title);
allWebtoonList4.push(data);
//console.log(data);
}
}, (error) => console.log(error));
//개봉 예정영화 기대지수순
const premovieinterest = 'https://movie.naver.com/movie/running/premovie.nhn?order=interestRate';
axios.get(premovieinterest).then(res => {
if (res.status === 200) {
let crawledMovie = [];
const $ = cheerio.load(res.data);
const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
$movieList.each(function (i) {
crawledMovie[i] = {
title: $(this).find('dt.tit a').text(),
img: $(this).find('div.thumb img').attr('src')
};
});
const data = crawledMovie.filter(m => m.title);
allWebtoonList4.push(data);
//console.log(data);
}
}, (error) => console.log(error));
//계봉 예정영화 예매순
const prereserve = 'https://movie.naver.com/movie/running/premovie.nhn?order=reserve';
axios.get(prereserve).then(res => {
if (res.status === 200) {
let crawledMovie = [];
const $ = cheerio.load(res.data);
const $movieList = $('div.lst_wrap ul.lst_detail_t1').children('li');
$movieList.each(function (i) {
crawledMovie[i] = {
title: $(this).find('dt.tit a').text(),
img: $(this).find('div.thumb img').attr('src')
};
});
const data = crawledMovie.filter(m => m.title);
allWebtoonList4.push(data);
//console.log(data);
}
}, (error) => console.log(error));
allWebtoons4 = allWebtoonList4;
}
getAllToons();
......@@ -780,18 +284,10 @@ getAllToons();
setInterval(getAllToons,5*60*1000);
//5분에 한번 수행
getAllToons2();
setInterval(getAllToons2,5*60*1000);
getAllToons3();
setInterval(getAllToons3,5*60*1000);
getAllToons4();
setInterval(getAllToons4,5*60*1000);
/* GET home page. */
//진아 : list :allWebtoons2.3 해도 되는지??!!
router.get('/',
function(req,res,next){
if(req.isAuthenticated()){
......@@ -802,9 +298,7 @@ router.get('/',
res.render('index',{
title: "니툰내툰",
list: allWebtoons
list: allWebtoons2
list: allWebtoons3
list: allWebtoons4
});
}
});
......