Akhidjon

Fixing some errors

......@@ -77,7 +77,7 @@ app.use(express.static(path.join(__dirname, 'public')));
connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '',
password : 'asd123',
port : 3306,
database : 'ytmt'
});
......
......@@ -6,7 +6,3 @@ body {
a {
color: #00B7FF;
}
.navbar #mylist .section-title .overlay{
background: blueviolet;
}
\ No newline at end of file
......
......@@ -148,31 +148,9 @@ router.get('/auth/logout/google',function (req,res) {
})
//
function gettop(){
var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_daily_ranking/serialized?timeStamp=1559440437553';
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 webtoon = {
toon_index : item.id,
name : item.title,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : "TOP-10",
site : site,
lates : item.latestWebtoonEpisode.episode
}
allWebtoonList.push(webtoon);
});
});
};
function getLatestToon(titleid, day ,cb) {
}
var daumCount = 0;
......@@ -193,19 +171,6 @@ function getDaumToons(_day) {
console.log("다음웹툰 DB 에러 : " + err);
} else {
list.forEach(function (item, idx) {
var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
var webtoon = {
toon_index : item.id,
name : item.title,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : day_name,
site : site,
latest : item.latestWebtoonEpisode.episode,
averageScore : item.webtoonServices.averageScore,
};
allWebtoonList.push(webtoon);
var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
var webtoon = {
......@@ -233,68 +198,59 @@ function getNaverToons() {
var webtoonCount = 0;
request(allWeeklyToonsUrl,function (err, res, html) {
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,
averageScore : 0
};
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, averageScore) VALUES(?) ON DUPLICATE KEY UPDATE averageScore=averageScore";
var values=[webtoon.toon_index, webtoon.name, webtoon.thum_link, webtoon.webtoon_link,webtoon.week, webtoon.site, webtoon.latest, webtoon.averageScore];
connection.query(sql,[values],function(err,result){
if (err) {
console.log("웹툰 DB 에러 : " + err);
} else {
console.log("웹툰 DB처리 완료!");
}
});
})
})
}
})
}
// 구현중
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처리 완료!`);
}
});
})
});
}
console.log(`다음웹툰 ${daumCount}개, 네이버웹툰 ${naverCount}개`)
});
}
// 모든 웹툰을 담고있는 배열
allWebtoons = new Array();
// 설명
function getAllToons() {
function getAllToons() {
allWebtoonList = new Array();
//월요일 다음 웹툰
getDaumToons('mon');
//화요일 다음 웹툰
......@@ -310,8 +266,6 @@ allWebtoons = new Array();
//일요일 다음 웹툰
getDaumToons('sun');
//네이버 웹툰
gettop();
getNaverToons();
allWebtoons = allWebtoonList;
......
......@@ -201,117 +201,6 @@
</div>
</div>
</div>
<<<<<<< HEAD
<div class="container">
<div class="row">
<div class="categories">
<ul class="cat">
<font size = 30>
다음 웹툰
</font>
<a onclick="Daum_webtoons.style.display=(Daum_webtoons.style.display=='none')?'block':'none';" href="javascript:void(0)">
<img src ='/images/daumicon.png' width="83" height="90" onclick="daum_click" />
</a>
<div style="display:none" id="Daum_webtoons">
<table>
<%
var current = "";
for(webtoon in list){
if(current!= list[webtoon].week && list[webtoon].site == 'daum'){
if(current!=""){
%>
</tr>
<% } %>
<tr>
<th><%= list[webtoon].week %></th>
<% } %>
<%
if(list[webtoon].site == 'daum')
{
%>
<td>
<a href="<%= list[webtoon].webtoon_link %>">
<img alt="img" width="83" height="90" src="<%= list[webtoon].thum_link %>"/>
</a>
<%= list[webtoon].name %>
</td>
<%
}
%>
<%
if(current!=list[webtoon].week) {
current = list[webtoon].week;
%>
<%
}
}
%>
</tr>
</table>
<!--</br>-->
</div>
<!--<br>-->
<font size = 30>
네이버 웹툰
</font>
<a onclick="Naver_webtoons.style.display=(Naver_webtoons.style.display=='none')?'block':'none';" href="javascript:void(0)">
<img src ='/images/navericon.png' width="83" height="90"/>
</a>
<div id="Naver_webtoons" style = "display:none">
<table>
<%
var current = "";
for(webtoon in list){
if(current!=list[webtoon].week && list[webtoon].site == 'naver'){
if(current!=""){
%>
</tr>
<% } %>
<tr>
<th><%= list[webtoon].week %></th>
<% } %>
<%
if(list[webtoon].site == 'naver')
{
%>
<td>
<a href="<%= list[webtoon].webtoon_link %>">
<img alt="img" width="83" height="90" src="<%= list[webtoon].thum_link %>"/>
</a>
<%= list[webtoon].name %>
</td>
<%
}
%>
<%
if(current!=list[webtoon].week) {
current = list[webtoon].week;
%>
<%
}
}
%>
</tr>
</table>
</br>
</div>
</br>
</div>
=======
</div>
>>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
</body>
</html>
......
......@@ -3,12 +3,8 @@
<head>
<title>내툰</title>
<link rel='stylesheet' href='/stylesheets/style2.css' />
<<<<<<< HEAD
<!-- Bootstrap -->
=======
<<!-- Bootstrap -->
>>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
<link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css">
......
......@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>웹툰 담기</title>
<link rel='stylesheet' href='/stylesheets/style2.css' />
<!-- Bootstrap -->
<<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css">
......
......@@ -2,8 +2,8 @@
<html>
<head>
<title>니툰</title>
<link rel='stylesheet' href='/stylesheets/style2.css'>
<!-- Bootstrap -->
<link rel='stylesheet' href='/stylesheets/style2.css' />
<<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css">
......@@ -54,8 +54,7 @@
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<a class="navbar-brand page-scroll" href="#page-top" style="font-family:Gugi">니툰</a>
</div>
<a class="navbar-brand page-scroll" href="#page-top" style="font-family:Gugi">니툰</a> </div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
......