Akhidjon

top10

......@@ -154,6 +154,35 @@ function getLatestToon(titleid, day ,cb) {
var daumCount = 0;
// Shows Top-10 webtoons
function gettop(){
var daum = 'http://webtoon.daum.net/data/pc/webtoon/list_daily_ranking/serialized?timeStamp=1559440437553';
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 : "TOP-10",
site : site,
lates : item.latestWebtoonEpisode.episode
}
allWebtoonList.push(webtoon);
});
});
};
//_day요일의 다음웹툰 불러오기
function getDaumToons(_day) {
......@@ -180,7 +209,8 @@ function getDaumToons(_day) {
webtoon_link : webtoon_link,
week : day_name,
site : site,
latest : 0
latest : item.latestWebtoonEpisode.episode,
averageScore : item.webtoonServices.averageScore
};
daumCount++;
allWebtoonList.push(webtoon);
......@@ -216,7 +246,8 @@ function getNaverToons() {
webtoon_link : webtoon_link,
week : week,
site : site,
latest : 0
latest : 0,
averageScore : 0
};
naverCount++;
allWebtoonList.push(webtoon);
......@@ -265,6 +296,8 @@ function getAllToons() {
getDaumToons('sat');
//일요일 다음 웹툰
getDaumToons('sun');
//Top10
gettop()
//네이버 웹툰
getNaverToons();
......
......@@ -2,7 +2,7 @@ var express = require('express');
var router = express.Router();
function addMyToons(id,index,cb){
connection.query("INSERT INTO user_toon_relation SET ?;", {user_id : id,toon_index : index},function (err) {
connection.query("INSERT INTO user_toon_relation SET ?;", {user_id : id, toon_index : index},function (err) {
if(err) {
throw err;
......
......@@ -35,14 +35,15 @@ CREATE TABLE `toon` (
`webtoon_link` varchar(225) DEFAULT NULL,
`site` varchar(45) DEFAULT NULL,
`week` varchar(45) DEFAULT NULL,
`latest` int(11) DEFAULT NULL
`latest` int(11) DEFAULT NULL,
`averageScore` FLOAT(23.11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 테이블의 덤프 데이터 `toon`
--
INSERT INTO `toon` (`toon_index`, `name`, `thum_link`, `webtoon_link`, `site`, `week`, `latest`) VALUES
INSERT INTO `toon` (`toon_index`, `name`, `thum_link`, `webtoon_link`, `site`, `week`, `latest`,`averageScore`) VALUES
(194, '대작 (2010)', 'http://i1.cartoon.daumcdn.net/svc/image/U03/cartoon/55277C7D043EDE0001', 'http://webtoon.daum.net/webtoon/view/drinkingtogether', 'daum', 'FRI', 0),
(553, '어쿠스틱 라이프', 'http://i1.cartoon.daumcdn.net/svc/image/U03/cartoon/55277772023D470003', 'http://webtoon.daum.net/webtoon/view/acoustic', 'daum', 'FRI', 0),
(783, '창백한 말', 'http://t1.daumcdn.net/webtoon/op/86943651213dd579461e3c356e41889909ff8a08', 'http://webtoon.daum.net/webtoon/view/palehorse', 'daum', 'WED', 0),
......