Akhidjon

Fixing some errors

...@@ -77,7 +77,7 @@ app.use(express.static(path.join(__dirname, 'public'))); ...@@ -77,7 +77,7 @@ app.use(express.static(path.join(__dirname, 'public')));
77 connection = mysql.createConnection({ 77 connection = mysql.createConnection({
78 host : 'localhost', 78 host : 'localhost',
79 user : 'root', 79 user : 'root',
80 - password : '', 80 + password : 'asd123',
81 port : 3306, 81 port : 3306,
82 database : 'ytmt' 82 database : 'ytmt'
83 }); 83 });
......
...@@ -6,7 +6,3 @@ body { ...@@ -6,7 +6,3 @@ body {
6 a { 6 a {
7 color: #00B7FF; 7 color: #00B7FF;
8 } 8 }
9 -
10 -.navbar #mylist .section-title .overlay{
11 - background: blueviolet;
12 -}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -148,31 +148,9 @@ router.get('/auth/logout/google',function (req,res) { ...@@ -148,31 +148,9 @@ router.get('/auth/logout/google',function (req,res) {
148 }) 148 })
149 149
150 // 150 //
151 -function gettop(){ 151 +function getLatestToon(titleid, day ,cb) {
152 - var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_daily_ranking/serialized?timeStamp=1559440437553';
153 - var site = 'daum';
154 -
155 - client.fetch(daum, {}, function (err, $, res, body){
156 -
157 - var data = JSON.parse(body);
158 - var list = data['data'];
159 -
160 - list.forEach(function(item, idx){
161 - var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
162 - var webtoon = {
163 - toon_index : item.id,
164 - name : item.title,
165 - thum_link : item.pcThumbnailImage.url,
166 - webtoon_link : webtoon_link,
167 - week : "TOP-10",
168 - site : site,
169 - lates : item.latestWebtoonEpisode.episode
170 - }
171 - allWebtoonList.push(webtoon);
172 - });
173 - });
174 -};
175 152
153 +}
176 154
177 var daumCount = 0; 155 var daumCount = 0;
178 156
...@@ -193,19 +171,6 @@ function getDaumToons(_day) { ...@@ -193,19 +171,6 @@ function getDaumToons(_day) {
193 console.log("다음웹툰 DB 에러 : " + err); 171 console.log("다음웹툰 DB 에러 : " + err);
194 } else { 172 } else {
195 list.forEach(function (item, idx) { 173 list.forEach(function (item, idx) {
196 - var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
197 - var webtoon = {
198 - toon_index : item.id,
199 - name : item.title,
200 - thum_link : item.pcThumbnailImage.url,
201 - webtoon_link : webtoon_link,
202 - week : day_name,
203 - site : site,
204 - latest : item.latestWebtoonEpisode.episode,
205 - averageScore : item.webtoonServices.averageScore,
206 - };
207 -
208 - allWebtoonList.push(webtoon);
209 174
210 var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); 175 var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString();
211 var webtoon = { 176 var webtoon = {
...@@ -233,68 +198,59 @@ function getNaverToons() { ...@@ -233,68 +198,59 @@ function getNaverToons() {
233 var webtoonCount = 0; 198 var webtoonCount = 0;
234 199
235 request(allWeeklyToonsUrl,function (err, res, html) { 200 request(allWeeklyToonsUrl,function (err, res, html) {
236 - if(!err){ 201 + if(!err){
237 - var $ = cheerio.load(html); 202 + var $ = cheerio.load(html);
238 - var p = Promise.resolve(); 203 + var p = Promise.resolve();
239 - var eachs = $(".thumb").each(function (i) { 204 + var eachs = $(".thumb").each(function (i) {
240 - var week = $(this).parent().parent().prev().attr('class'); 205 +
241 - var webtoon_link = "http://comic.naver.com" + $(this).children().first().attr('href'); 206 + var week = $(this).parent().parent().prev().attr('class');
242 - var thumb_link = $(this).children().first().children().first().attr('src'); 207 + var webtoon_link = "http://comic.naver.com" + $(this).children().first().attr('href');
243 - var name = $(this).next().text(); 208 + var thumb_link = $(this).children().first().children().first().attr('src');
244 - var titleid = webtoon_link.split('?')[1].split('&')[0].split('=')[1]; 209 + var name = $(this).next().text();
245 - var site = 'naver'; 210 + var titleid = webtoon_link.split('?')[1].split('&')[0].split('=')[1];
246 - var webtoon= { 211 + var site = 'naver';
247 - toon_index: titleid, 212 + var webtoon= {
248 - name : name, 213 + toon_index: titleid,
249 - thum_link : thumb_link, 214 + name : name,
250 - webtoon_link : webtoon_link, 215 + thum_link : thumb_link,
251 - week : week, 216 + webtoon_link : webtoon_link,
252 - site : site, 217 + week : week,
253 - latest : 0, 218 + site : site,
254 - averageScore : 0 219 + latest : 0
255 - }; 220 + };
256 - allWebtoonList.push(webtoon); 221 + naverCount++;
257 - }); 222 + allWebtoonList.push(webtoon);
258 - 223 + });
259 - p.then(function() {
260 - i = 0;
261 - allWebtoonList.forEach(function (webtoon) {
262 - var sql= "INSERT INTO `toon` (toon_index, name, thum_link, webtoon_link, week, site, latest, averageScore) VALUES(?) ON DUPLICATE KEY UPDATE averageScore=averageScore";
263 - var values=[webtoon.toon_index, webtoon.name, webtoon.thum_link, webtoon.webtoon_link,webtoon.week, webtoon.site, webtoon.latest, webtoon.averageScore];
264 -
265 - connection.query(sql,[values],function(err,result){
266 - if (err) {
267 - console.log("웹툰 DB 에러 : " + err);
268 - } else {
269 - console.log("웹툰 DB처리 완료!");
270 - }
271 - });
272 - })
273 - })
274 - }
275 - })
276 - }
277 -
278 -
279 -
280 -
281 -
282 -
283 -// 구현중
284 224
285 -// 설명 225 + p.then(function() {
226 + i = 0;
227 + allWebtoonList.forEach(function (webtoon) {
228 + var sql= "INSERT INTO `toon` (toon_index, name, thum_link, webtoon_link, week, site, latest) VALUES(?) ON DUPLICATE KEY UPDATE latest=latest";
229 + var values=[webtoon.toon_index, webtoon.name, webtoon.thum_link, webtoon.webtoon_link,webtoon.week, webtoon.site, webtoon.latest];
230 +
231 + connection.query(sql,[values],function(err,result){
232 + if(err) {
233 + console.log("웹툰 DB 에러 : " + err);
234 + } else {
235 + webtoonCount++;
236 + console.log(`웹툰 ${webtoonCount}개 DB처리 완료!`);
237 + }
238 + });
239 + })
240 + });
241 + }
242 + console.log(`다음웹툰 ${daumCount}개, 네이버웹툰 ${naverCount}개`)
243 + });
244 +}
286 245
287 // 모든 웹툰을 담고있는 배열 246 // 모든 웹툰을 담고있는 배열
288 -
289 allWebtoons = new Array(); 247 allWebtoons = new Array();
290 248
291 // 설명 249 // 설명
292 - function getAllToons() { 250 +function getAllToons() {
293 251
294 allWebtoonList = new Array(); 252 allWebtoonList = new Array();
295 253
296 -
297 -
298 //월요일 다음 웹툰 254 //월요일 다음 웹툰
299 getDaumToons('mon'); 255 getDaumToons('mon');
300 //화요일 다음 웹툰 256 //화요일 다음 웹툰
...@@ -310,8 +266,6 @@ allWebtoons = new Array(); ...@@ -310,8 +266,6 @@ allWebtoons = new Array();
310 //일요일 다음 웹툰 266 //일요일 다음 웹툰
311 getDaumToons('sun'); 267 getDaumToons('sun');
312 //네이버 웹툰 268 //네이버 웹툰
313 - gettop();
314 -
315 getNaverToons(); 269 getNaverToons();
316 270
317 allWebtoons = allWebtoonList; 271 allWebtoons = allWebtoonList;
......
...@@ -201,117 +201,6 @@ ...@@ -201,117 +201,6 @@
201 </div> 201 </div>
202 </div> 202 </div>
203 </div> 203 </div>
204 -<<<<<<< HEAD
205 - <div class="container">
206 - <div class="row">
207 - <div class="categories">
208 - <ul class="cat">
209 -
210 - <font size = 30>
211 - 다음 웹툰
212 - </font>
213 -
214 - <a onclick="Daum_webtoons.style.display=(Daum_webtoons.style.display=='none')?'block':'none';" href="javascript:void(0)">
215 - <img src ='/images/daumicon.png' width="83" height="90" onclick="daum_click" />
216 - </a>
217 - <div style="display:none" id="Daum_webtoons">
218 - <table>
219 - <%
220 - var current = "";
221 - for(webtoon in list){
222 -
223 - if(current!= list[webtoon].week && list[webtoon].site == 'daum'){
224 - if(current!=""){
225 - %>
226 - </tr>
227 - <% } %>
228 - <tr>
229 - <th><%= list[webtoon].week %></th>
230 - <% } %>
231 - <%
232 - if(list[webtoon].site == 'daum')
233 - {
234 - %>
235 - <td>
236 - <a href="<%= list[webtoon].webtoon_link %>">
237 - <img alt="img" width="83" height="90" src="<%= list[webtoon].thum_link %>"/>
238 - </a>
239 - <%= list[webtoon].name %>
240 - </td>
241 - <%
242 - }
243 - %>
244 -
245 - <%
246 - if(current!=list[webtoon].week) {
247 - current = list[webtoon].week;
248 - %>
249 -
250 - <%
251 - }
252 - }
253 - %>
254 - </tr>
255 - </table>
256 - <!--</br>-->
257 - </div>
258 - <!--<br>-->
259 -
260 - <font size = 30>
261 - 네이버 웹툰
262 - </font>
263 - <a onclick="Naver_webtoons.style.display=(Naver_webtoons.style.display=='none')?'block':'none';" href="javascript:void(0)">
264 - <img src ='/images/navericon.png' width="83" height="90"/>
265 - </a>
266 - <div id="Naver_webtoons" style = "display:none">
267 -
268 - <table>
269 - <%
270 - var current = "";
271 - for(webtoon in list){
272 -
273 - if(current!=list[webtoon].week && list[webtoon].site == 'naver'){
274 - if(current!=""){
275 - %>
276 - </tr>
277 - <% } %>
278 - <tr>
279 - <th><%= list[webtoon].week %></th>
280 - <% } %>
281 - <%
282 - if(list[webtoon].site == 'naver')
283 - {
284 - %>
285 - <td>
286 - <a href="<%= list[webtoon].webtoon_link %>">
287 - <img alt="img" width="83" height="90" src="<%= list[webtoon].thum_link %>"/>
288 - </a>
289 - <%= list[webtoon].name %>
290 - </td>
291 - <%
292 - }
293 - %>
294 -
295 - <%
296 - if(current!=list[webtoon].week) {
297 - current = list[webtoon].week;
298 - %>
299 -
300 - <%
301 - }
302 - }
303 - %>
304 - </tr>
305 - </table>
306 - </br>
307 -
308 - </div>
309 -
310 - </br>
311 -
312 -</div>
313 -=======
314 </div> 204 </div>
315 ->>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
316 </body> 205 </body>
317 </html> 206 </html>
......
...@@ -3,12 +3,8 @@ ...@@ -3,12 +3,8 @@
3 <head> 3 <head>
4 <title>내툰</title> 4 <title>내툰</title>
5 <link rel='stylesheet' href='/stylesheets/style2.css' /> 5 <link rel='stylesheet' href='/stylesheets/style2.css' />
6 -<<<<<<< HEAD
7 - <!-- Bootstrap -->
8 -=======
9 6
10 <<!-- Bootstrap --> 7 <<!-- Bootstrap -->
11 ->>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f
12 <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css"> 8 <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css">
13 <link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css"> 9 <link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css">
14 10
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 <meta charset="UTF-8"> 4 <meta charset="UTF-8">
5 <title>웹툰 담기</title> 5 <title>웹툰 담기</title>
6 <link rel='stylesheet' href='/stylesheets/style2.css' /> 6 <link rel='stylesheet' href='/stylesheets/style2.css' />
7 - <!-- Bootstrap --> 7 + <<!-- Bootstrap -->
8 <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css"> 8 <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css">
9 <link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css"> 9 <link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css">
10 10
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>니툰</title> 4 <title>니툰</title>
5 - <link rel='stylesheet' href='/stylesheets/style2.css'> 5 + <link rel='stylesheet' href='/stylesheets/style2.css' />
6 - <!-- Bootstrap --> 6 + <<!-- Bootstrap -->
7 <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css"> 7 <link rel="stylesheet" type="text/css" href="/stylesheets/bootstrap.css">
8 <link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css"> 8 <link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome.css">
9 9
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
54 <!-- Brand and toggle get grouped for better mobile display --> 54 <!-- Brand and toggle get grouped for better mobile display -->
55 <div class="navbar-header"> 55 <div class="navbar-header">
56 <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> 56 <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>
57 - <a class="navbar-brand page-scroll" href="#page-top" style="font-family:Gugi">니툰</a> 57 + <a class="navbar-brand page-scroll" href="#page-top" style="font-family:Gugi">니툰</a> </div>
58 - </div>
59 <!-- Collect the nav links, forms, and other content for toggling --> 58 <!-- Collect the nav links, forms, and other content for toggling -->
60 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 59 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
61 <ul class="nav navbar-nav navbar-right"> 60 <ul class="nav navbar-nav navbar-right">
......