Showing
1 changed file
with
197 additions
and
93 deletions
... | @@ -78,17 +78,23 @@ function getAllToons3(){ | ... | @@ -78,17 +78,23 @@ function getAllToons3(){ |
78 | const $ = cheerio.load(res.data); | 78 | const $ = cheerio.load(res.data); |
79 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 79 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
80 | var tn = 2019; | 80 | var tn = 2019; |
81 | + var week='finished' | ||
81 | $toonList.each(function (i) { | 82 | $toonList.each(function (i) { |
82 | naver2019[i] = { | 83 | naver2019[i] = { |
83 | - title: $(this).find('dl > dt > a').text(), | 84 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
84 | - img: $(this).find('div > a > img').attr('src'), | 85 | + name : $(this).find('dl > dt > a').text(), |
85 | - index: $(this).find('li > div > a').attr('href'), | 86 | + thumb_link: $(this).find('div > a > img').attr('src'), |
86 | - year : tn | 87 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
88 | + week : week, | ||
89 | + //year : tn, | ||
90 | + site : site, | ||
91 | + latest : 0 | ||
87 | }; | 92 | }; |
93 | + allWebtoonList3.push(naver2019[i]); | ||
88 | }); | 94 | }); |
89 | 95 | ||
90 | - const data = naver2019.filter(m => m.title); | 96 | + //const data = naver2019.filter(m => m.title); |
91 | - allWebtoonList3.push(data); | 97 | + //allWebtoonList3.push(data); |
92 | //console.log(allWebtoonList3) | 98 | //console.log(allWebtoonList3) |
93 | } | 99 | } |
94 | }, (error) => console.log(error)); | 100 | }, (error) => console.log(error)); |
... | @@ -102,17 +108,23 @@ function getAllToons3(){ | ... | @@ -102,17 +108,23 @@ function getAllToons3(){ |
102 | const $ = cheerio.load(res.data); | 108 | const $ = cheerio.load(res.data); |
103 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 109 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
104 | var tn = 2018; | 110 | var tn = 2018; |
111 | + var week='finished' | ||
105 | $toonList.each(function (i) { | 112 | $toonList.each(function (i) { |
106 | naver2018[i] = { | 113 | naver2018[i] = { |
107 | - title: $(this).find('dl > dt > a').text(), | 114 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
108 | - img: $(this).find('div > a > img').attr('src'), | 115 | + name : $(this).find('dl > dt > a').text(), |
109 | - index: $(this).find('li > div > a').attr('href'), | 116 | + thumb_link: $(this).find('div > a > img').attr('src'), |
110 | - year : tn | 117 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
118 | + week : week, | ||
119 | + //year : tn, | ||
120 | + site : site, | ||
121 | + latest : 0 | ||
111 | }; | 122 | }; |
123 | + allWebtoonList3.push(naver2018[i]); | ||
112 | }); | 124 | }); |
113 | 125 | ||
114 | - const data = naver2018.filter(m => m.title); | 126 | + //const data = naver2018.filter(m => m.title); |
115 | - allWebtoonList3.push(data); | 127 | + //allWebtoonList3.push(data); |
116 | //console.log(allWebtoonList3) | 128 | //console.log(allWebtoonList3) |
117 | } | 129 | } |
118 | }, (error) => console.log(error)); | 130 | }, (error) => console.log(error)); |
... | @@ -126,17 +138,23 @@ function getAllToons3(){ | ... | @@ -126,17 +138,23 @@ function getAllToons3(){ |
126 | const $ = cheerio.load(res.data); | 138 | const $ = cheerio.load(res.data); |
127 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 139 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
128 | var tn = 2017; | 140 | var tn = 2017; |
141 | + var week='finished' | ||
129 | $toonList.each(function (i) { | 142 | $toonList.each(function (i) { |
130 | naver2017[i] = { | 143 | naver2017[i] = { |
131 | - title: $(this).find('dl > dt > a').text(), | 144 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
132 | - img: $(this).find('div > a > img').attr('src'), | 145 | + name : $(this).find('dl > dt > a').text(), |
133 | - index: $(this).find('li > div > a').attr('href'), | 146 | + thumb_link: $(this).find('div > a > img').attr('src'), |
134 | - year : tn | 147 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
148 | + week : week, | ||
149 | + //year : tn, | ||
150 | + site : site, | ||
151 | + latest : 0 | ||
135 | }; | 152 | }; |
153 | + allWebtoonList3.push(naver2017[i]); | ||
136 | }); | 154 | }); |
137 | 155 | ||
138 | - const data = naver2017.filter(m => m.title); | 156 | + //const data = naver2017.filter(m => m.title); |
139 | - allWebtoonList3.push(data); | 157 | + //allWebtoonList3.push(data); |
140 | //console.log(allWebtoonList3) | 158 | //console.log(allWebtoonList3) |
141 | } | 159 | } |
142 | }, (error) => console.log(error)); | 160 | }, (error) => console.log(error)); |
... | @@ -150,21 +168,26 @@ function getAllToons3(){ | ... | @@ -150,21 +168,26 @@ function getAllToons3(){ |
150 | const $ = cheerio.load(res.data); | 168 | const $ = cheerio.load(res.data); |
151 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 169 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
152 | var tn = 2016; | 170 | var tn = 2016; |
171 | + var week='finished' | ||
153 | $toonList.each(function (i) { | 172 | $toonList.each(function (i) { |
154 | naver2016[i] = { | 173 | naver2016[i] = { |
155 | - title: $(this).find('dl > dt > a').text(), | 174 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
156 | - img: $(this).find('div > a > img').attr('src'), | 175 | + name : $(this).find('dl > dt > a').text(), |
157 | - index: $(this).find('li > div > a').attr('href'), | 176 | + thumb_link: $(this).find('div > a > img').attr('src'), |
158 | - year : tn | 177 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
178 | + week : week, | ||
179 | + //year : tn, | ||
180 | + site : site, | ||
181 | + latest : 0 | ||
159 | }; | 182 | }; |
183 | + allWebtoonList3.push(naver2016[i]); | ||
160 | }); | 184 | }); |
161 | 185 | ||
162 | - const data = naver2016.filter(m => m.title); | 186 | + //const data = naver2016.filter(m => m.title); |
163 | - allWebtoonList3.push(data); | 187 | + //allWebtoonList3.push(data); |
164 | //console.log(allWebtoonList3) | 188 | //console.log(allWebtoonList3) |
165 | } | 189 | } |
166 | }, (error) => console.log(error)); | 190 | }, (error) => console.log(error)); |
167 | - | ||
168 | //2015년 연재 네이버 웹툰 | 191 | //2015년 연재 네이버 웹툰 |
169 | const naver2015 = 'https://comic.naver.com/webtoon/period.nhn?period=2015'; | 192 | const naver2015 = 'https://comic.naver.com/webtoon/period.nhn?period=2015'; |
170 | 193 | ||
... | @@ -174,17 +197,23 @@ function getAllToons3(){ | ... | @@ -174,17 +197,23 @@ function getAllToons3(){ |
174 | const $ = cheerio.load(res.data); | 197 | const $ = cheerio.load(res.data); |
175 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 198 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
176 | var tn = 2015; | 199 | var tn = 2015; |
200 | + var week='finished' | ||
177 | $toonList.each(function (i) { | 201 | $toonList.each(function (i) { |
178 | naver2015[i] = { | 202 | naver2015[i] = { |
179 | - title: $(this).find('dl > dt > a').text(), | 203 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
180 | - img: $(this).find('div > a > img').attr('src'), | 204 | + name : $(this).find('dl > dt > a').text(), |
181 | - index: $(this).find('li > div > a').attr('href'), | 205 | + thumb_link: $(this).find('div > a > img').attr('src'), |
182 | - year : tn | 206 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
207 | + week : week, | ||
208 | + //year : tn, | ||
209 | + site : site, | ||
210 | + latest : 0 | ||
183 | }; | 211 | }; |
212 | + allWebtoonList3.push(naver2015[i]); | ||
184 | }); | 213 | }); |
185 | 214 | ||
186 | - const data = naver2015.filter(m => m.title); | 215 | + //const data = naver2015.filter(m => m.title); |
187 | - allWebtoonList3.push(data); | 216 | + //allWebtoonList3.push(data); |
188 | //console.log(allWebtoonList3) | 217 | //console.log(allWebtoonList3) |
189 | } | 218 | } |
190 | }, (error) => console.log(error)); | 219 | }, (error) => console.log(error)); |
... | @@ -197,17 +226,23 @@ function getAllToons3(){ | ... | @@ -197,17 +226,23 @@ function getAllToons3(){ |
197 | const $ = cheerio.load(res.data); | 226 | const $ = cheerio.load(res.data); |
198 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 227 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
199 | var tn = 2014; | 228 | var tn = 2014; |
229 | + var week='finished' | ||
200 | $toonList.each(function (i) { | 230 | $toonList.each(function (i) { |
201 | naver2014[i] = { | 231 | naver2014[i] = { |
202 | - title: $(this).find('dl > dt > a').text(), | 232 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
203 | - img: $(this).find('div > a > img').attr('src'), | 233 | + name : $(this).find('dl > dt > a').text(), |
204 | - index: $(this).find('li > div > a').attr('href'), | 234 | + thumb_link: $(this).find('div > a > img').attr('src'), |
205 | - year : tn | 235 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
236 | + week : week, | ||
237 | + //year : tn, | ||
238 | + site : site, | ||
239 | + latest : 0 | ||
206 | }; | 240 | }; |
241 | + allWebtoonList3.push(naver2014[i]); | ||
207 | }); | 242 | }); |
208 | 243 | ||
209 | - const data = naver2014.filter(m => m.title); | 244 | + //const data = naver2014.filter(m => m.title); |
210 | - allWebtoonList3.push(data); | 245 | + //allWebtoonList3.push(data); |
211 | //console.log(allWebtoonList3) | 246 | //console.log(allWebtoonList3) |
212 | } | 247 | } |
213 | }, (error) => console.log(error)); | 248 | }, (error) => console.log(error)); |
... | @@ -221,17 +256,23 @@ function getAllToons3(){ | ... | @@ -221,17 +256,23 @@ function getAllToons3(){ |
221 | const $ = cheerio.load(res.data); | 256 | const $ = cheerio.load(res.data); |
222 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 257 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
223 | var tn = 2013; | 258 | var tn = 2013; |
259 | + var week='finished' | ||
224 | $toonList.each(function (i) { | 260 | $toonList.each(function (i) { |
225 | naver2013[i] = { | 261 | naver2013[i] = { |
226 | - title: $(this).find('dl > dt > a').text(), | 262 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
227 | - img: $(this).find('div > a > img').attr('src'), | 263 | + name : $(this).find('dl > dt > a').text(), |
228 | - index: $(this).find('li > div > a').attr('href'), | 264 | + thumb_link: $(this).find('div > a > img').attr('src'), |
229 | - year : tn | 265 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
266 | + week : week, | ||
267 | + //year : tn, | ||
268 | + site : site, | ||
269 | + latest : 0 | ||
230 | }; | 270 | }; |
271 | + allWebtoonList3.push(naver2013[i]); | ||
231 | }); | 272 | }); |
232 | 273 | ||
233 | - const data = naver2013.filter(m => m.title); | 274 | + //const data = naver2013.filter(m => m.title); |
234 | - allWebtoonList3.push(data); | 275 | + //allWebtoonList3.push(data); |
235 | //console.log(allWebtoonList3) | 276 | //console.log(allWebtoonList3) |
236 | } | 277 | } |
237 | }, (error) => console.log(error)); | 278 | }, (error) => console.log(error)); |
... | @@ -245,17 +286,23 @@ function getAllToons3(){ | ... | @@ -245,17 +286,23 @@ function getAllToons3(){ |
245 | const $ = cheerio.load(res.data); | 286 | const $ = cheerio.load(res.data); |
246 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 287 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
247 | var tn = 2012; | 288 | var tn = 2012; |
289 | + var week='finished' | ||
248 | $toonList.each(function (i) { | 290 | $toonList.each(function (i) { |
249 | naver2012[i] = { | 291 | naver2012[i] = { |
250 | - title: $(this).find('dl > dt > a').text(), | 292 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
251 | - img: $(this).find('div > a > img').attr('src'), | 293 | + name : $(this).find('dl > dt > a').text(), |
252 | - index: $(this).find('li > div > a').attr('href'), | 294 | + thumb_link: $(this).find('div > a > img').attr('src'), |
253 | - year : tn | 295 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
296 | + week : week, | ||
297 | + //year : tn, | ||
298 | + site : site, | ||
299 | + latest : 0 | ||
254 | }; | 300 | }; |
301 | + allWebtoonList3.push(naver2012[i]); | ||
255 | }); | 302 | }); |
256 | 303 | ||
257 | - const data = naver2012.filter(m => m.title); | 304 | + //const data = naver2012.filter(m => m.title); |
258 | - allWebtoonList3.push(data); | 305 | + //allWebtoonList3.push(data); |
259 | //console.log(allWebtoonList3) | 306 | //console.log(allWebtoonList3) |
260 | } | 307 | } |
261 | }, (error) => console.log(error)); | 308 | }, (error) => console.log(error)); |
... | @@ -269,17 +316,23 @@ function getAllToons3(){ | ... | @@ -269,17 +316,23 @@ function getAllToons3(){ |
269 | const $ = cheerio.load(res.data); | 316 | const $ = cheerio.load(res.data); |
270 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 317 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
271 | var tn = 2011; | 318 | var tn = 2011; |
319 | + var week='finished' | ||
272 | $toonList.each(function (i) { | 320 | $toonList.each(function (i) { |
273 | naver2011[i] = { | 321 | naver2011[i] = { |
274 | - title: $(this).find('dl > dt > a').text(), | 322 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
275 | - img: $(this).find('div > a > img').attr('src'), | 323 | + name : $(this).find('dl > dt > a').text(), |
276 | - index: $(this).find('li > div > a').attr('href'), | 324 | + thumb_link: $(this).find('div > a > img').attr('src'), |
277 | - year : tn | 325 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
326 | + week : week, | ||
327 | + //year : tn, | ||
328 | + site : site, | ||
329 | + latest : 0 | ||
278 | }; | 330 | }; |
331 | + allWebtoonList3.push(naver2011[i]); | ||
279 | }); | 332 | }); |
280 | 333 | ||
281 | - const data = naver2011.filter(m => m.title); | 334 | + //const data = naver2011.filter(m => m.title); |
282 | - allWebtoonList3.push(data); | 335 | + //allWebtoonList3.push(data); |
283 | //console.log(allWebtoonList3) | 336 | //console.log(allWebtoonList3) |
284 | } | 337 | } |
285 | }, (error) => console.log(error)); | 338 | }, (error) => console.log(error)); |
... | @@ -293,17 +346,23 @@ function getAllToons3(){ | ... | @@ -293,17 +346,23 @@ function getAllToons3(){ |
293 | const $ = cheerio.load(res.data); | 346 | const $ = cheerio.load(res.data); |
294 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 347 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
295 | var tn = 2010; | 348 | var tn = 2010; |
349 | + var week='finished' | ||
296 | $toonList.each(function (i) { | 350 | $toonList.each(function (i) { |
297 | naver2010[i] = { | 351 | naver2010[i] = { |
298 | - title: $(this).find('dl > dt > a').text(), | 352 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
299 | - img: $(this).find('div > a > img').attr('src'), | 353 | + name : $(this).find('dl > dt > a').text(), |
300 | - index: $(this).find('li > div > a').attr('href'), | 354 | + thumb_link: $(this).find('div > a > img').attr('src'), |
301 | - year : tn | 355 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
356 | + week : week, | ||
357 | + //year : tn, | ||
358 | + site : site, | ||
359 | + latest : 0 | ||
302 | }; | 360 | }; |
361 | + allWebtoonList3.push(naver2010[i]); | ||
303 | }); | 362 | }); |
304 | 363 | ||
305 | - const data = naver2010.filter(m => m.title); | 364 | + //const data = naver2010.filter(m => m.title); |
306 | - allWebtoonList3.push(data); | 365 | + //allWebtoonList3.push(data); |
307 | //console.log(allWebtoonList3) | 366 | //console.log(allWebtoonList3) |
308 | } | 367 | } |
309 | }, (error) => console.log(error)); | 368 | }, (error) => console.log(error)); |
... | @@ -317,17 +376,23 @@ function getAllToons3(){ | ... | @@ -317,17 +376,23 @@ function getAllToons3(){ |
317 | const $ = cheerio.load(res.data); | 376 | const $ = cheerio.load(res.data); |
318 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 377 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
319 | var tn = 2009; | 378 | var tn = 2009; |
379 | + var week='finished' | ||
320 | $toonList.each(function (i) { | 380 | $toonList.each(function (i) { |
321 | naver2009[i] = { | 381 | naver2009[i] = { |
322 | - title: $(this).find('dl > dt > a').text(), | 382 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
323 | - img: $(this).find('div > a > img').attr('src'), | 383 | + name : $(this).find('dl > dt > a').text(), |
324 | - index: $(this).find('li > div > a').attr('href'), | 384 | + thumb_link: $(this).find('div > a > img').attr('src'), |
325 | - year : tn | 385 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
386 | + week : week, | ||
387 | + //year : tn, | ||
388 | + site : site, | ||
389 | + latest : 0 | ||
326 | }; | 390 | }; |
391 | + allWebtoonList3.push(naver2009[i]); | ||
327 | }); | 392 | }); |
328 | 393 | ||
329 | - const data = naver2009.filter(m => m.title); | 394 | + //const data = naver2009.filter(m => m.title); |
330 | - allWebtoonList3.push(data); | 395 | + //allWebtoonList3.push(data); |
331 | //console.log(allWebtoonList3) | 396 | //console.log(allWebtoonList3) |
332 | } | 397 | } |
333 | }, (error) => console.log(error)); | 398 | }, (error) => console.log(error)); |
... | @@ -341,17 +406,23 @@ function getAllToons3(){ | ... | @@ -341,17 +406,23 @@ function getAllToons3(){ |
341 | const $ = cheerio.load(res.data); | 406 | const $ = cheerio.load(res.data); |
342 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 407 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
343 | var tn = 2008; | 408 | var tn = 2008; |
409 | + var week='finished' | ||
344 | $toonList.each(function (i) { | 410 | $toonList.each(function (i) { |
345 | naver2008[i] = { | 411 | naver2008[i] = { |
346 | - title: $(this).find('dl > dt > a').text(), | 412 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
347 | - img: $(this).find('div > a > img').attr('src'), | 413 | + name : $(this).find('dl > dt > a').text(), |
348 | - index: $(this).find('li > div > a').attr('href'), | 414 | + thumb_link: $(this).find('div > a > img').attr('src'), |
349 | - year : tn | 415 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
416 | + week : week, | ||
417 | + //year : tn, | ||
418 | + site : site, | ||
419 | + latest : 0 | ||
350 | }; | 420 | }; |
421 | + allWebtoonList3.push(naver2008[i]); | ||
351 | }); | 422 | }); |
352 | 423 | ||
353 | - const data = naver2008.filter(m => m.title); | 424 | + //const data = naver2008.filter(m => m.title); |
354 | - allWebtoonList3.push(data); | 425 | + //allWebtoonList3.push(data); |
355 | //console.log(allWebtoonList3) | 426 | //console.log(allWebtoonList3) |
356 | } | 427 | } |
357 | }, (error) => console.log(error)); | 428 | }, (error) => console.log(error)); |
... | @@ -365,17 +436,23 @@ function getAllToons3(){ | ... | @@ -365,17 +436,23 @@ function getAllToons3(){ |
365 | const $ = cheerio.load(res.data); | 436 | const $ = cheerio.load(res.data); |
366 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 437 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
367 | var tn = 2007; | 438 | var tn = 2007; |
439 | + var week='finished' | ||
368 | $toonList.each(function (i) { | 440 | $toonList.each(function (i) { |
369 | naver2007[i] = { | 441 | naver2007[i] = { |
370 | - title: $(this).find('dl > dt > a').text(), | 442 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
371 | - img: $(this).find('div > a > img').attr('src'), | 443 | + name : $(this).find('dl > dt > a').text(), |
372 | - index: $(this).find('li > div > a').attr('href'), | 444 | + thumb_link: $(this).find('div > a > img').attr('src'), |
373 | - year : tn | 445 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
446 | + week : week, | ||
447 | + //year : tn, | ||
448 | + site : site, | ||
449 | + latest : 0 | ||
374 | }; | 450 | }; |
451 | + allWebtoonList3.push(naver2007[i]); | ||
375 | }); | 452 | }); |
376 | 453 | ||
377 | - const data = naver2007.filter(m => m.title); | 454 | + //const data = naver2007.filter(m => m.title); |
378 | - allWebtoonList3.push(data); | 455 | + //allWebtoonList3.push(data); |
379 | //console.log(allWebtoonList3) | 456 | //console.log(allWebtoonList3) |
380 | } | 457 | } |
381 | }, (error) => console.log(error)); | 458 | }, (error) => console.log(error)); |
... | @@ -389,17 +466,23 @@ function getAllToons3(){ | ... | @@ -389,17 +466,23 @@ function getAllToons3(){ |
389 | const $ = cheerio.load(res.data); | 466 | const $ = cheerio.load(res.data); |
390 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 467 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
391 | var tn = 2006; | 468 | var tn = 2006; |
469 | + var week='finished' | ||
392 | $toonList.each(function (i) { | 470 | $toonList.each(function (i) { |
393 | naver2006[i] = { | 471 | naver2006[i] = { |
394 | - title: $(this).find('dl > dt > a').text(), | 472 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
395 | - img: $(this).find('div > a > img').attr('src'), | 473 | + name : $(this).find('dl > dt > a').text(), |
396 | - index: $(this).find('li > div > a').attr('href'), | 474 | + thumb_link: $(this).find('div > a > img').attr('src'), |
397 | - year : tn | 475 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
476 | + week : week, | ||
477 | + //year : tn, | ||
478 | + site : site, | ||
479 | + latest : 0 | ||
398 | }; | 480 | }; |
481 | + allWebtoonList3.push(naver2006[i]); | ||
399 | }); | 482 | }); |
400 | 483 | ||
401 | - const data = naver2006.filter(m => m.title); | 484 | + //const data = naver2006.filter(m => m.title); |
402 | - allWebtoonList3.push(data); | 485 | + //allWebtoonList3.push(data); |
403 | //console.log(allWebtoonList3) | 486 | //console.log(allWebtoonList3) |
404 | } | 487 | } |
405 | }, (error) => console.log(error)); | 488 | }, (error) => console.log(error)); |
... | @@ -413,23 +496,44 @@ function getAllToons3(){ | ... | @@ -413,23 +496,44 @@ function getAllToons3(){ |
413 | const $ = cheerio.load(res.data); | 496 | const $ = cheerio.load(res.data); |
414 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); | 497 | const $toonList = $('#content > div.list_area.daily_img > ul > li'); |
415 | var tn = 2005; | 498 | var tn = 2005; |
499 | + var week='finished' | ||
416 | $toonList.each(function (i) { | 500 | $toonList.each(function (i) { |
417 | naver2005[i] = { | 501 | naver2005[i] = { |
418 | - title: $(this).find('dl > dt > a').text(), | 502 | + toon_index : $(this).find('li > div > a').attr('href').split('=')[1], |
419 | - img: $(this).find('div > a > img').attr('src'), | 503 | + name : $(this).find('dl > dt > a').text(), |
420 | - index: $(this).find('li > div > a').attr('href'), | 504 | + thumb_link: $(this).find('div > a > img').attr('src'), |
421 | - year : tn | 505 | + webtoon_link: "http://comic.naver.com"+$(this).find('li > div > a').attr('href'), |
506 | + week : week, | ||
507 | + //year : tn, | ||
508 | + site : site, | ||
509 | + latest : 0 | ||
422 | }; | 510 | }; |
511 | + allWebtoonList3.push(naver2005[i]); | ||
423 | }); | 512 | }); |
424 | 513 | ||
425 | - const data = naver2005.filter(m => m.title); | 514 | + //const data = naver2005.filter(m => m.title); |
426 | - allWebtoonList3.push(data); | 515 | + //allWebtoonList3.push(data); |
427 | //console.log(allWebtoonList3) | 516 | //console.log(allWebtoonList3) |
428 | } | 517 | } |
518 | + p.then(function() { | ||
519 | + i = 0; | ||
520 | + allWebtoonList3.forEach(function (webtoon) { | ||
521 | + var sql= "INSERT INTO `toon` (toon_index, name, thum_link, webtoon_link, week, site, latest) VALUES(?) ON DUPLICATE KEY UPDATE latest=latest"; | ||
522 | + var values=[webtoon.toon_index, webtoon.name, webtoon.thum_link, webtoon.webtoon_link,webtoon.week, webtoon.site, webtoon.latest]; | ||
523 | + connection.query(sql,[values],function(err,result){ | ||
524 | + if (err) { | ||
525 | + console.log("웹툰 DB 에러 : " + err); | ||
526 | + } else { | ||
527 | + // console.log("웹툰 DB처리 완료!"); | ||
528 | + } | ||
529 | + }); | ||
530 | + //}); | ||
531 | + }) | ||
429 | }, (error) => console.log(error)); | 532 | }, (error) => console.log(error)); |
430 | - | ||
431 | allWebtoons3 = allWebtoonList3; | 533 | allWebtoons3 = allWebtoonList3; |
432 | - } | 534 | + }) |
535 | +} | ||
536 | + | ||
433 | 537 | ||
434 | 538 | ||
435 | 539 | ... | ... |
-
Please register or login to post a comment