Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대선
/
Recruitment_Information_chatbot
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
김대선
2021-05-08 19:03:55 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e029914891af6facbe2b34e836ccfbbf9830e371
e0299148
1 parent
bde2c034
데이터 추출 및 분류 기능을 함수로 분리
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
router/naver.js
router/naver.js
View file @
e029914
...
...
@@ -39,11 +39,7 @@ const makeObject = (array)=>{
return
result
}
router
.
get
(
'/'
,
(
req
,
res
,
error
)
=>
{
res
.
send
(
"naver home"
)
})
router
.
get
(
'/recruitment'
,
async
(
req
,
res
,
error
)
=>
{
const
getData
=
async
()
=>
{
const
browser
=
await
puppeteer
.
launch
();
const
page
=
await
browser
.
newPage
();
...
...
@@ -57,7 +53,7 @@ router.get('/recruitment', async (req, res, error)=>{
await
page
.
click
(
'#moreDiv > button'
).
catch
((
error
)
=>
{
})
await
page
.
waitForTimeout
(
3
00
)
await
page
.
waitForTimeout
(
2
00
)
content
=
await
page
.
content
()
}
}
...
...
@@ -73,7 +69,15 @@ router.get('/recruitment', async (req, res, error)=>{
resArr
=
result
.
split
(
'</li><li>'
)
result
=
makeObject
(
resArr
)
console
.
log
(
result
)
res
.
send
(
result
)
return
result
;
}
router
.
get
(
'/'
,
(
req
,
res
,
error
)
=>
{
res
.
send
(
"naver home"
)
})
router
.
get
(
'/recruitment'
,
async
(
req
,
res
,
error
)
=>
{
res
.
send
(
await
getData
())
})
...
...
Please
register
or
login
to post a comment