Showing
2 changed files
with
10 additions
and
58 deletions
... | @@ -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 : 'password', | 80 | + password : '', |
81 | port : 3306, | 81 | port : 3306, |
82 | database : 'ytmt' | 82 | database : 'ytmt' |
83 | }); | 83 | }); | ... | ... |
... | @@ -193,8 +193,6 @@ function getDaumToons(_day) { | ... | @@ -193,8 +193,6 @@ function getDaumToons(_day) { |
193 | console.log("다음웹툰 DB 에러 : " + err); | 193 | console.log("다음웹툰 DB 에러 : " + err); |
194 | } else { | 194 | } else { |
195 | list.forEach(function (item, idx) { | 195 | list.forEach(function (item, idx) { |
196 | - | ||
197 | -<<<<<<< HEAD | ||
198 | var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); | 196 | var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); |
199 | var webtoon = { | 197 | var webtoon = { |
200 | toon_index : item.id, | 198 | toon_index : item.id, |
... | @@ -208,7 +206,7 @@ function getDaumToons(_day) { | ... | @@ -208,7 +206,7 @@ function getDaumToons(_day) { |
208 | }; | 206 | }; |
209 | 207 | ||
210 | allWebtoonList.push(webtoon); | 208 | allWebtoonList.push(webtoon); |
211 | -======= | 209 | + |
212 | var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); | 210 | var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); |
213 | var webtoon = { | 211 | var webtoon = { |
214 | toon_index : item.id, | 212 | toon_index : item.id, |
... | @@ -221,7 +219,6 @@ function getDaumToons(_day) { | ... | @@ -221,7 +219,6 @@ function getDaumToons(_day) { |
221 | }; | 219 | }; |
222 | daumCount++; | 220 | daumCount++; |
223 | allWebtoonList.push(webtoon); | 221 | allWebtoonList.push(webtoon); |
224 | ->>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f | ||
225 | }); | 222 | }); |
226 | } | 223 | } |
227 | }); | 224 | }); |
... | @@ -236,8 +233,7 @@ function getNaverToons() { | ... | @@ -236,8 +233,7 @@ function getNaverToons() { |
236 | var webtoonCount = 0; | 233 | var webtoonCount = 0; |
237 | 234 | ||
238 | request(allWeeklyToonsUrl,function (err, res, html) { | 235 | request(allWeeklyToonsUrl,function (err, res, html) { |
239 | -<<<<<<< HEAD | 236 | + if(!err){ |
240 | - if(!err){ | ||
241 | var $ = cheerio.load(html); | 237 | var $ = cheerio.load(html); |
242 | var p = Promise.resolve(); | 238 | var p = Promise.resolve(); |
243 | var eachs = $(".thumb").each(function (i) { | 239 | var eachs = $(".thumb").each(function (i) { |
... | @@ -274,66 +270,22 @@ function getNaverToons() { | ... | @@ -274,66 +270,22 @@ function getNaverToons() { |
274 | } | 270 | } |
275 | }); | 271 | }); |
276 | }) | 272 | }) |
277 | -======= | 273 | + }) |
278 | - if(!err){ | 274 | + } |
279 | - var $ = cheerio.load(html); | 275 | + }) |
280 | - var p = Promise.resolve(); | 276 | + } |
281 | - var eachs = $(".thumb").each(function (i) { | ||
282 | - | ||
283 | - var week = $(this).parent().parent().prev().attr('class'); | ||
284 | - var webtoon_link = "http://comic.naver.com" + $(this).children().first().attr('href'); | ||
285 | - var thumb_link = $(this).children().first().children().first().attr('src'); | ||
286 | - var name = $(this).next().text(); | ||
287 | - var titleid = webtoon_link.split('?')[1].split('&')[0].split('=')[1]; | ||
288 | - var site = 'naver'; | ||
289 | - var webtoon= { | ||
290 | - toon_index: titleid, | ||
291 | - name : name, | ||
292 | - thum_link : thumb_link, | ||
293 | - webtoon_link : webtoon_link, | ||
294 | - week : week, | ||
295 | - site : site, | ||
296 | - latest : 0 | ||
297 | - }; | ||
298 | - naverCount++; | ||
299 | - allWebtoonList.push(webtoon); | ||
300 | - }); | ||
301 | 277 | ||
302 | - p.then(function() { | ||
303 | - i = 0; | ||
304 | - allWebtoonList.forEach(function (webtoon) { | ||
305 | - var sql= "INSERT INTO `toon` (toon_index, name, thum_link, webtoon_link, week, site, latest) VALUES(?) ON DUPLICATE KEY UPDATE latest=latest"; | ||
306 | - var values=[webtoon.toon_index, webtoon.name, webtoon.thum_link, webtoon.webtoon_link,webtoon.week, webtoon.site, webtoon.latest]; | ||
307 | - | ||
308 | - connection.query(sql,[values],function(err,result){ | ||
309 | - if(err) { | ||
310 | - console.log("웹툰 DB 에러 : " + err); | ||
311 | - } else { | ||
312 | - webtoonCount++; | ||
313 | - console.log(`웹툰 ${webtoonCount}개 DB처리 완료!`); | ||
314 | - } | ||
315 | ->>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f | ||
316 | - }); | ||
317 | - }) | ||
318 | - }); | ||
319 | - } | ||
320 | - console.log(`다음웹툰 ${daumCount}개, 네이버웹툰 ${naverCount}개`) | ||
321 | - }); | ||
322 | -} | ||
323 | 278 | ||
324 | -<<<<<<< HEAD | ||
325 | 279 | ||
326 | 280 | ||
327 | 281 | ||
328 | -// 구현중 | ||
329 | -function getTomicsToons(){ | ||
330 | 282 | ||
331 | -} | 283 | +// 구현중 |
332 | 284 | ||
333 | // 설명 | 285 | // 설명 |
334 | -======= | 286 | + |
335 | // 모든 웹툰을 담고있는 배열 | 287 | // 모든 웹툰을 담고있는 배열 |
336 | ->>>>>>> 0b039040370950fe61e1c6ae5d5cf6650db9652f | 288 | + |
337 | allWebtoons = new Array(); | 289 | allWebtoons = new Array(); |
338 | 290 | ||
339 | // 설명 | 291 | // 설명 | ... | ... |
-
Please register or login to post a comment