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
이진아
2019-12-03 00:36:46 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
10646df0e3eb1df7c534ff7804f00879cd2f2319
10646df0
1 parent
8e24fd3b
2019년 연재 네이버 웹툰
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletions
routes/index.js
routes/index.js
View file @
10646df
var
express
=
require
(
'express'
);
var
cheerio
=
require
(
'cheerio'
);
var
request
=
require
(
'request'
);
const
axios
=
require
(
'axios'
);
//axios 추가 설치된거 확인하기
var
router
=
express
.
Router
();
var
mysql
=
require
(
'mysql'
);
var
client
=
require
(
'cheerio-httpcli'
);
...
...
@@ -306,6 +308,38 @@ function getAllToons2() {
allWebtoons2
=
allWebtoonList2
;
}
allWebtoons3
=
new
Array
();
function
getAllToons3
(){
allWebtoonList3
=
new
Array
();
//2019년 연재 네이버 웹툰
const
naver2019
=
'https://comic.naver.com/webtoon/period.nhn?period=2019'
;
axios
.
get
(
naver2019
).
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
let
naver2019
=
[];
const
$
=
cheerio
.
load
(
res
.
data
);
const
$movieList
=
$
(
'#content > div.list_area.daily_img > ul > li'
);
var
tn
=
2019
;
$movieList
.
each
(
function
(
i
)
{
naver2019
[
i
]
=
{
title
:
$
(
this
).
find
(
'dl > dt > a'
).
text
(),
img
:
$
(
this
).
find
(
'div > a > img'
).
attr
(
'src'
),
index
:
$
(
this
).
find
(
'li > div > a'
).
attr
(
'href'
),
year
:
tn
};
});
const
data
=
naver2019
.
filter
(
m
=>
m
.
title
);
allWebtoonList3
.
push
(
data
);
//console.log(allWebtoonList3)
}
},
(
error
)
=>
console
.
log
(
error
));
allWebtoons3
=
allWebtoonList3
;
}
getAllToons
();
//처음 한번 수행
setInterval
(
getAllToons
,
5
*
60
*
1000
);
...
...
@@ -314,10 +348,12 @@ setInterval(getAllToons,5*60*1000);
getAllToons2
();
setInterval
(
getAllToons2
,
5
*
60
*
1000
);
getAllToons3
();
setInterval
(
getAllToons3
,
5
*
60
*
1000
);
/* GET home page. */
//진아 : list :allWebtoons2 해도 되는지??!!
//진아 : list :allWebtoons2
.3
해도 되는지??!!
router
.
get
(
'/'
,
function
(
req
,
res
,
next
){
if
(
req
.
isAuthenticated
()){
...
...
@@ -329,6 +365,7 @@ router.get('/',
title
:
"니툰내툰"
,
list
:
allWebtoons
list
:
allWebtoons2
list
:
allWebtoons3
});
}
});
...
...
Please
register
or
login
to post a comment