Showing
1 changed file
with
50 additions
and
169 deletions
... | @@ -30,7 +30,7 @@ passport.use(new KakaoStrategy({ | ... | @@ -30,7 +30,7 @@ passport.use(new KakaoStrategy({ |
30 | } | 30 | } |
31 | )); | 31 | )); |
32 | 32 | ||
33 | -// kakao 로그인, // passport.authenticate('kakao',{state: "myStateValue"}) | 33 | +// kakao 로그인 |
34 | router.get('/auth/login/kakao', passport.authenticate('kakao')); | 34 | router.get('/auth/login/kakao', passport.authenticate('kakao')); |
35 | 35 | ||
36 | // kakao 로그인 연동 콜백 | 36 | // kakao 로그인 연동 콜백 |
... | @@ -68,18 +68,11 @@ function getLatestToon(titleid, day ,cb) { | ... | @@ -68,18 +68,11 @@ function getLatestToon(titleid, day ,cb) { |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | -// 설명 | 71 | +function getDaumToons(_day){ |
72 | -allWebtoons = new Array(); | 72 | + // X요일 다음 웹툰 |
73 | - | 73 | + var day = _day; |
74 | -// 설명 | 74 | + var day_name = day; |
75 | -function getAllToons() { | 75 | + var daum = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${day}?timeStamp=1515819276574`; |
76 | - | ||
77 | - allWebtoonList = new Array(); | ||
78 | - | ||
79 | - //월요일 다음 웹툰 | ||
80 | - var mon='mon'; | ||
81 | - var mon_name='MON'; | ||
82 | - var daum = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${mon}?timeStamp=1515819276574`; | ||
83 | var site = 'daum'; | 76 | var site = 'daum'; |
84 | 77 | ||
85 | client.fetch(daum, {}, function (err, $, res, body) { | 78 | client.fetch(daum, {}, function (err, $, res, body) { |
... | @@ -91,37 +84,11 @@ function getAllToons() { | ... | @@ -91,37 +84,11 @@ function getAllToons() { |
91 | 84 | ||
92 | var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); | 85 | var webtoon_link = 'http://webtoon.daum.net/webtoon/view/' + item.nickname.toString(); |
93 | var webtoon = { | 86 | var webtoon = { |
94 | - toon_index: item.id, | 87 | + toon_index : item.id, |
95 | - name: item.title, | ||
96 | - thum_link: item.pcThumbnailImage.url, | ||
97 | - webtoon_link: webtoon_link, | ||
98 | - week :mon_name, | ||
99 | - site: site, | ||
100 | - latest: 0 | ||
101 | - }; | ||
102 | - | ||
103 | - allWebtoonList.push(webtoon); | ||
104 | - }); | ||
105 | - }); | ||
106 | - | ||
107 | - //화요일 다음 웹툰 | ||
108 | - var tue='tue'; | ||
109 | - var tue_name='TUE'; | ||
110 | - var daum1 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${tue}?timeStamp=1515819276574`; | ||
111 | - | ||
112 | - client.fetch(daum1, {}, function (err, $, res, body) { | ||
113 | - var data = JSON.parse(body); | ||
114 | - var list = data["data"]; | ||
115 | - | ||
116 | - list.forEach(function(item, idx){ | ||
117 | - | ||
118 | - var webtoon_link='http://webtoon.daum.net/webtoon/view/'+item.nickname.toString(); | ||
119 | - var webtoon= { | ||
120 | - toon_index: item.id, | ||
121 | name : item.title, | 88 | name : item.title, |
122 | thum_link : item.pcThumbnailImage.url, | 89 | thum_link : item.pcThumbnailImage.url, |
123 | webtoon_link : webtoon_link, | 90 | webtoon_link : webtoon_link, |
124 | - week : tue_name, | 91 | + week : day_name, |
125 | site : site, | 92 | site : site, |
126 | latest : 0 | 93 | latest : 0 |
127 | }; | 94 | }; |
... | @@ -129,134 +96,9 @@ function getAllToons() { | ... | @@ -129,134 +96,9 @@ function getAllToons() { |
129 | allWebtoonList.push(webtoon); | 96 | allWebtoonList.push(webtoon); |
130 | }); | 97 | }); |
131 | }); | 98 | }); |
99 | +} | ||
132 | 100 | ||
133 | - //수요일 다음 웹툰 | 101 | +function getNaverToons(){ |
134 | - var wed='wed'; | ||
135 | - var wed_name='WED'; | ||
136 | - var daum2 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${wed}?timeStamp=1515819276574`; | ||
137 | - | ||
138 | - client.fetch(daum2, {}, function (err, $, res, body) { | ||
139 | - | ||
140 | - var data = JSON.parse(body); | ||
141 | - var list = data["data"]; | ||
142 | - | ||
143 | - list.forEach(function(item, idx){ | ||
144 | - | ||
145 | - var webtoon_link='http://webtoon.daum.net/webtoon/view/'+item.nickname.toString(); | ||
146 | - var webtoon= { | ||
147 | - toon_index: item.id, | ||
148 | - name : item.title, | ||
149 | - thum_link : item.pcThumbnailImage.url, | ||
150 | - webtoon_link : webtoon_link, | ||
151 | - week : wed_name, | ||
152 | - site : site, | ||
153 | - latest : 0 | ||
154 | - }; | ||
155 | - | ||
156 | - allWebtoonList.push(webtoon); | ||
157 | - }); | ||
158 | - }); | ||
159 | - | ||
160 | - //목요일 다음 웹툰 | ||
161 | - var thu='thu'; | ||
162 | - var daum3 =`http://webtoon.daum.net/data/pc/webtoon/list_serialized/${thu}?timeStamp=1515819276574`; | ||
163 | - var thu_name='THU'; | ||
164 | - | ||
165 | - client.fetch(daum3, {}, function (err, $, res, body) { | ||
166 | - | ||
167 | - var data = JSON.parse(body); | ||
168 | - var list = data["data"]; | ||
169 | - | ||
170 | - list.forEach(function(item, idx){ | ||
171 | - | ||
172 | - var webtoon_link='http://webtoon.daum.net/webtoon/view/'+item.nickname.toString(); | ||
173 | - var webtoon= { | ||
174 | - toon_index: item.id, | ||
175 | - name : item.title, | ||
176 | - thum_link : item.pcThumbnailImage.url, | ||
177 | - webtoon_link : webtoon_link, | ||
178 | - week : thu_name, | ||
179 | - site : site, | ||
180 | - latest : 0 | ||
181 | - }; | ||
182 | - | ||
183 | - allWebtoonList.push(webtoon); | ||
184 | - }); | ||
185 | - | ||
186 | - }); | ||
187 | - | ||
188 | - //금요일 다음 웹툰 | ||
189 | - var fri='fri'; | ||
190 | - var daum4 =`http://webtoon.daum.net/data/pc/webtoon/list_serialized/${fri}?timeStamp=1515819276574`; | ||
191 | - var fri_name='FRI'; | ||
192 | - client.fetch(daum4, {}, function (err, $, res, body) { | ||
193 | - var data = JSON.parse(body); | ||
194 | - var list = data["data"]; | ||
195 | - 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 : fri_name, | ||
203 | - site : site, | ||
204 | - latest : 0 | ||
205 | - }; | ||
206 | - allWebtoonList.push(webtoon); | ||
207 | - }); | ||
208 | - | ||
209 | - }); | ||
210 | - | ||
211 | - //토요일 다음 웹툰 | ||
212 | - var sat='sat'; | ||
213 | - var daum5 =`http://webtoon.daum.net/data/pc/webtoon/list_serialized/${sat}?timeStamp=1515819276574`; | ||
214 | - var sat_name='SAT'; | ||
215 | - client.fetch(daum5, {}, function (err, $, res, body) { | ||
216 | - var data = JSON.parse(body); | ||
217 | - var list = data["data"]; | ||
218 | - list.forEach(function(item, idx){ | ||
219 | - var webtoon_link='http://webtoon.daum.net/webtoon/view/'+item.nickname.toString(); | ||
220 | - var webtoon= { | ||
221 | - toon_index: item.id, | ||
222 | - name : item.title, | ||
223 | - thum_link : item.pcThumbnailImage.url, | ||
224 | - webtoon_link : webtoon_link, | ||
225 | - week : sat_name, | ||
226 | - site : site, | ||
227 | - latest : 0 | ||
228 | - }; | ||
229 | - allWebtoonList.push(webtoon); | ||
230 | - }); | ||
231 | - | ||
232 | - }); | ||
233 | - | ||
234 | - //일요일 다음 웹툰 | ||
235 | - var sun='sun'; | ||
236 | - var daum6 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${sun}?timeStamp=1515819276574`; | ||
237 | - var sun_name='SUN'; | ||
238 | - client.fetch(daum6, {}, function (err, $, res, body) { | ||
239 | - var data = JSON.parse(body); | ||
240 | - var list = data["data"]; | ||
241 | - list.forEach(function(item, idx){ | ||
242 | - var webtoon_link='http://webtoon.daum.net/webtoon/view/'+item.nickname.toString(); | ||
243 | - var webtoon= { | ||
244 | - toon_index: item.id, | ||
245 | - name : item.title, | ||
246 | - thum_link : item.pcThumbnailImage.url, | ||
247 | - webtoon_link : webtoon_link, | ||
248 | - week : sun_name, | ||
249 | - site : site, | ||
250 | - latest : 0 | ||
251 | - }; | ||
252 | - allWebtoonList.push(webtoon); | ||
253 | - }); | ||
254 | - }); | ||
255 | - | ||
256 | - | ||
257 | - | ||
258 | - | ||
259 | - //네이버 웹툰 | ||
260 | var allWeeklyToonsUrl = "http://comic.naver.com/webtoon/weekday.nhn"; | 102 | var allWeeklyToonsUrl = "http://comic.naver.com/webtoon/weekday.nhn"; |
261 | request(allWeeklyToonsUrl,function (err, res, html) { | 103 | request(allWeeklyToonsUrl,function (err, res, html) { |
262 | if(!err){ | 104 | if(!err){ |
... | @@ -298,8 +140,47 @@ function getAllToons() { | ... | @@ -298,8 +140,47 @@ function getAllToons() { |
298 | }); | 140 | }); |
299 | } | 141 | } |
300 | }); | 142 | }); |
143 | +} | ||
144 | + | ||
145 | +// 구현중 | ||
146 | +function getTomicsToons(){ | ||
147 | + | ||
148 | +} | ||
149 | + | ||
150 | +// 설명 | ||
151 | +allWebtoons = new Array(); | ||
152 | + | ||
153 | +// 설명 | ||
154 | +function getAllToons() { | ||
301 | 155 | ||
156 | + allWebtoonList = new Array(); | ||
157 | + | ||
158 | + //월요일 다음 웹툰 | ||
159 | + getDaumToons('mon'); | ||
160 | + | ||
161 | + //화요일 다음 웹툰 | ||
162 | + getDaumToons('tue'); | ||
163 | + | ||
164 | + //수요일 다음 웹툰 | ||
165 | + getDaumToons('wed'); | ||
166 | + | ||
167 | + //목요일 다음 웹툰 | ||
168 | + getDaumToons('thu'); | ||
169 | + | ||
170 | + //금요일 다음 웹툰 | ||
171 | + getDaumToons('fri'); | ||
172 | + | ||
173 | + //토요일 다음 웹툰 | ||
174 | + getDaumToons('sat'); | ||
175 | + | ||
176 | + //일요일 다음 웹툰 | ||
177 | + getDaumToons('sun'); | ||
178 | + | ||
179 | + //네이버 웹툰 | ||
180 | + getNaverToons(); | ||
302 | 181 | ||
182 | + //투믹스 웹툰 | ||
183 | + getTomicsToons(); | ||
303 | 184 | ||
304 | allWebtoons = allWebtoonList; | 185 | allWebtoons = allWebtoonList; |
305 | }; | 186 | }; |
... | @@ -308,7 +189,7 @@ function getAllToons() { | ... | @@ -308,7 +189,7 @@ function getAllToons() { |
308 | getAllToons(); | 189 | getAllToons(); |
309 | 190 | ||
310 | //5분에 한번 수행 | 191 | //5분에 한번 수행 |
311 | -setInterval(getAllToons,5*60*1000); | 192 | +setInterval(getAllToons, 5*60*1000); |
312 | 193 | ||
313 | /* GET home page. */ | 194 | /* GET home page. */ |
314 | router.get('/', function(req,res,next) { | 195 | router.get('/', function(req,res,next) { | ... | ... |
-
Please register or login to post a comment