Toggle navigation
Toggle navigation
This project
Loading...
Sign in
안형준
/
YTMT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
윤혜원
2018-11-29 19:27:28 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a5b0a8e92ce69f3a56791bcc4d0d22495c7bf119
a5b0a8e9
1 parent
4de31aff
다음 웹툰allToons 배열에 삽입 성공!
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
182 additions
and
110 deletions
.idea/workspace.xml
app.js
routes/daum.js
routes/index.js
views/index.ejs
.idea/workspace.xml
View file @
a5b0a8e
This diff is collapsed. Click to expand it.
app.js
View file @
a5b0a8e
...
...
@@ -13,7 +13,8 @@ var mytoons = require('./routes/mytoons');
var
passport
=
require
(
'passport'
);
var
setting
=
require
(
'./routes/setting'
);
var
session
=
require
(
'express-session'
);
var
toonviewer
=
require
(
'./routes/toonviewer'
)
var
toonviewer
=
require
(
'./routes/toonviewer'
);
//port
...
...
@@ -61,6 +62,7 @@ app.use('/users', users);
app
.
use
(
'/mytoons'
,
mytoons
);
app
.
use
(
'/setting'
,
setting
);
app
.
use
(
'/toonviewer'
,
toonviewer
);
//app.use('/daum', daum);
//app.use(express.static('views'));
...
...
routes/daum.js
deleted
100644 → 0
View file @
4de31af
var
client
=
require
(
'cheerio-httpcli'
);
//월요일 웹툰
var
mon
=
'mon'
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
mon
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
mon
);
});
});
//화요일 웹툰
var
tue
=
'tue'
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
tue
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
tue
);
});
});
//수요일 웹툰
var
wed
=
'wed'
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
wed
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
wed
);
});
});
//목요일 웹툰
var
thu
=
'thu'
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
thu
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
thu
);
});
});
//금요일웹툰
var
fri
=
'fri'
;
var
daum1
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
fri
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum1
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list1
=
data
[
"data"
];
list1
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
fri
);
});
});
//토요일 웹툰
var
sat
=
'sat'
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
sat
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
sat
);
});
});
//일요일 웹툰
var
sun
=
'sun'
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
sun
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
//다음 웹툰 아이디, 제목, 요일
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
sun
);
});
});
\ No newline at end of file
routes/index.js
View file @
a5b0a8e
...
...
@@ -3,6 +3,7 @@ var cheerio = require('cheerio');
var
request
=
require
(
'request'
);
var
router
=
express
.
Router
();
var
mysql
=
require
(
'mysql'
);
var
client
=
require
(
'cheerio-httpcli'
);
var
passport
=
require
(
'passport'
),
KakaoStrategy
=
require
(
'passport-kakao'
).
Strategy
;
...
...
@@ -41,8 +42,7 @@ router.get('/auth/login/kakao/callback',
function
loginByThirdparty
(
accessToken
,
refreshToken
,
profile
)
{
var
stmt_duplicated
=
'INSERT INTO user(id) VALUES(?) ON DUPLICATE KEY UPDATE id=?;'
connection
.
query
(
stmt_duplicated
,
[
profile
.
_json
.
id
,
profile
.
_json
.
id
]
,
function
(
err
,
result
)
{
connection
.
query
(
stmt_duplicated
,
[
profile
.
_json
.
id
]
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
log
(
"로그인 쿼리중 에러 : "
+
err
);
}
else
{
...
...
@@ -92,8 +92,180 @@ function getLatestToon(titleid, day ,cb) {
}
function
getAllToons
()
{
var
allWeeklyToonsUrl
=
"http://comic.naver.com/webtoon/weekday.nhn"
;
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
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
,
webtoon_link
:
webtoon_link
,
week
:
tue_name
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
});
//수요일 다음 웹툰
var
wed
=
'wed'
;
var
wed_name
=
'WED'
;
var
daum2
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
wed
}
?timeStamp=1515819276574`
;
client
.
fetch
(
daum2
,
{},
function
(
err
,
$
,
res
,
body
)
{
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
list
.
forEach
(
function
(
item
,
idx
){
console
.
log
(
item
.
id
+
' '
+
item
.
title
+
' '
+
wed
);
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
:
wed_name
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
});
//목요일 다음 웹툰
var
thu
=
'thu'
;
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
);
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
,
webtoon_link
:
webtoon_link
,
week
:
thu_name
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
});
//금요일 다음 웹툰
var
fri
=
'fri'
;
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
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
:
fri_name
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
});
//토요일 다음 웹툰
var
sat
=
'sat'
;
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
,
webtoon_link
:
webtoon_link
,
week
:
sat_name
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
});
//일요일 다음 웹툰
var
sun
=
'sun'
;
var
daum6
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
sun
}
?timeStamp=1515819276574`
;
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
,
webtoon_link
:
webtoon_link
,
week
:
sun_name
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
});
var
allWeeklyToonsUrl
=
"http://comic.naver.com/webtoon/weekday.nhn"
;
request
(
allWeeklyToonsUrl
,
function
(
err
,
res
,
html
)
{
if
(
!
err
){
var
$
=
cheerio
.
load
(
html
);
...
...
@@ -104,13 +276,14 @@ 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
webtoon
=
{
toon_index
:
titleid
,
name
:
name
,
thum_link
:
thumb_link
,
webtoon_link
:
webtoon_link
,
week
:
week
,
site
:
site
,
latest
:
0
};
...
...
@@ -135,7 +308,7 @@ function getAllToons() {
}
});
allWebtoons
=
allWebtoonList
;
}
}
;
getAllToons
();
//처음 한번 수행
...
...
views/index.ejs
View file @
a5b0a8e
...
...
@@ -8,13 +8,13 @@
<h1>
<
%= title %>
</h1>
<p>
웹툰 리스트
</p>
<a
href=
"/auth/login/kakao"
class=
"btn btn-block btn-lg btn-warning btn_login"
>
로그인
</a>
<table>
<
%
var current = "";
for(webtoon in list){
if(current!=list[webtoon].week){
if(current!=""){
%>
...
...
Please
register
or
login
to post a comment