Akhidjon

fixing errors

......@@ -77,7 +77,7 @@ app.use(express.static(path.join(__dirname, 'public')));
connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'password',
password : '',
port : 3306,
database : 'ytmt'
});
......
......@@ -193,8 +193,6 @@ function getDaumToons(_day) {
console.log("다음웹툰 DB 에러 : " + err);
} else {
list.forEach(function (item, idx) {
<<<<<<< HEAD
var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
var webtoon = {
toon_index : item.id,
......@@ -208,7 +206,7 @@ function getDaumToons(_day) {
};
allWebtoonList.push(webtoon);
=======
var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
var webtoon = {
toon_index : item.id,
......@@ -221,7 +219,6 @@ function getDaumToons(_day) {
};
daumCount++;
allWebtoonList.push(webtoon);
>>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
});
}
});
......@@ -236,8 +233,7 @@ function getNaverToons() {
var webtoonCount = 0;
request(allWeeklyToonsUrl,function (err, res, html) {
<<<<<<< HEAD
if(!err){
if(!err){
var $ = cheerio.load(html);
var p = Promise.resolve();
var eachs = $(".thumb").each(function (i) {
......@@ -274,66 +270,22 @@ function getNaverToons() {
}
});
})
=======
if(!err){
var $ = cheerio.load(html);
var p = Promise.resolve();
var eachs = $(".thumb").each(function (i) {
var week = $(this).parent().parent().prev().attr('class');
var webtoon_link = "http://comic.naver.com" + $(this).children().first().attr('href');
var thumb_link = $(this).children().first().children().first().attr('src');
var name = $(this).next().text();
var titleid = webtoon_link.split('?')[1].split('&')[0].split('=')[1];
var site = 'naver';
var webtoon= {
toon_index: titleid,
name : name,
thum_link : thumb_link,
webtoon_link : webtoon_link,
week : week,
site : site,
latest : 0
};
naverCount++;
allWebtoonList.push(webtoon);
});
})
}
})
}
p.then(function() {
i = 0;
allWebtoonList.forEach(function (webtoon) {
var sql= "INSERT INTO `toon` (toon_index, name, thum_link, webtoon_link, week, site, latest) VALUES(?) ON DUPLICATE KEY UPDATE latest=latest";
var values=[webtoon.toon_index, webtoon.name, webtoon.thum_link, webtoon.webtoon_link,webtoon.week, webtoon.site, webtoon.latest];
connection.query(sql,[values],function(err,result){
if(err) {
console.log("웹툰 DB 에러 : " + err);
} else {
webtoonCount++;
console.log(`웹툰 ${webtoonCount}개 DB처리 완료!`);
}
>>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
});
})
});
}
console.log(`다음웹툰 ${daumCount}개, 네이버웹툰 ${naverCount}개`)
});
}
<<<<<<< HEAD
// 구현중
function getTomicsToons(){
}
// 구현중
// 설명
=======
// 모든 웹툰을 담고있는 배열
>>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
allWebtoons = new Array();
// 설명
......