윤혜원

다음 웹툰 썸네일이미지 크롤링 성공!

This diff is collapsed. Click to expand it.
......@@ -94,49 +94,47 @@ function getLatestToon(titleid, day ,cb) {
function getAllToons() {
allWebtoonList = new Array();
//월요일 다음 웹툰
var mon='mon';
var daum = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${mon}?timeStamp=1515819276574`;
var site='daum';
var mon_name='MON';
client.fetch(daum, {}, function (err, $, res, body) {
var data = JSON.parse(body);
var list = data["data"];
console.log(list);
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 : webtoon_link,
webtoon_link : webtoon_link,
week : mon_name,
site : site,
latest : 0
};
allWebtoonList.push(webtoon);
var mon='mon';
var mon_name='MON';
var daum = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${mon}?timeStamp=1515819276574`;
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 :mon_name,
site: site,
latest: 0
};
allWebtoonList.push(webtoon);
});
});
});
//화요일 다음 웹툰
var tue='tue';
var tue_name='TUE';
var daum1 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${tue}?timeStamp=1515819276574`;
client.fetch(daum1, {}, 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 : webtoon_link,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : tue_name,
site : site,
latest : 0
};
allWebtoonList.push(webtoon);
});
......@@ -157,7 +155,7 @@ function getAllToons() {
var webtoon= {
toon_index: item.id,
name : item.title,
thum_link : webtoon_link,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : wed_name,
site : site,
......@@ -170,7 +168,7 @@ function getAllToons() {
//목요일 다음 웹툰
var thu='thu';
var daum3 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${thu}?timeStamp=1515819276574`;
var daum3 =`http://webtoon.daum.net/data/pc/webtoon/list_serialized/${thu}?timeStamp=1515819276574`;
var thu_name='THU';
client.fetch(daum3, {}, function (err, $, res, body) {
var data = JSON.parse(body);
......@@ -180,7 +178,7 @@ function getAllToons() {
var webtoon= {
toon_index: item.id,
name : item.title,
thum_link : webtoon_link,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : thu_name,
site : site,
......@@ -193,18 +191,17 @@ function getAllToons() {
//금요일 다음 웹툰
var fri='fri';
var daum4 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${fri}?timeStamp=1515819276574`;
var daum4 =`http://webtoon.daum.net/data/pc/webtoon/list_serialized/${fri}?timeStamp=1515819276574`;
var fri_name='FRI';
client.fetch(daum4, {}, function (err, $, res, body) {
var data = JSON.parse(body);
var list1 = data["data"];
list1.forEach(function(item, idx){
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 : webtoon_link,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : fri_name,
site : site,
......@@ -217,19 +214,17 @@ function getAllToons() {
//토요일 다음 웹툰
var sat='sat';
var daum5 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${sat}?timeStamp=1515819276574`;
var daum5 =`http://webtoon.daum.net/data/pc/webtoon/list_serialized/${sat}?timeStamp=1515819276574`;
var sat_name='SAT';
client.fetch(daum5, {}, 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 : webtoon_link,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : sat_name,
site : site,
......@@ -243,18 +238,17 @@ function getAllToons() {
//일요일 다음 웹툰
var sun='sun';
var daum6 = `http://webtoon.daum.net/data/pc/webtoon/list_serialized/${sun}?timeStamp=1515819276574`;
var sun_name='SUN'
var sun_name='SUN';
client.fetch(daum6, {}, 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 : webtoon_link,
thum_link : item.pcThumbnailImage.url,
webtoon_link : webtoon_link,
week : sun_name,
site : site,
......@@ -262,7 +256,6 @@ function getAllToons() {
};
allWebtoonList.push(webtoon);
});
});
var allWeeklyToonsUrl = "http://comic.naver.com/webtoon/weekday.nhn";
......@@ -276,7 +269,7 @@ function getAllToons() {
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 site = 'naver';
var webtoon= {
toon_index: titleid,
name : name,
......