Toggle navigation
Toggle navigation
This project
Loading...
Sign in
윤준석
/
mamuri-bot
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
윤준석
2022-05-19 00:58:17 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c1655d8a5dc45d1a03399523d38e1a7b9e4d4bfa
c1655d8a
1 parent
5c3d9cc8
HOTFIX: go-rod connection close
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
joongna/service/item.go
joongna/service/item.go
View file @
c1655d8
...
...
@@ -84,7 +84,16 @@ func getItemsInfoByKeyword(keyword string) ([]model.ApiResponseItem, error) {
func
crawlingNaverCafe
(
cafeUrl
string
)
(
*
model
.
Item
,
error
)
{
path
,
_
:=
launcher
.
LookPath
()
u
:=
launcher
.
New
()
.
Bin
(
path
)
.
MustLaunch
()
frame
:=
rod
.
New
()
.
ControlURL
(
u
)
.
MustConnect
()
.
MustPage
(
cafeUrl
)
.
MustElement
(
"iframe#cafe_main"
)
browser
:=
rod
.
New
()
.
ControlURL
(
u
)
.
MustConnect
()
defer
func
(
browser
*
rod
.
Browser
)
{
err
:=
browser
.
Close
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
}(
browser
)
frame
:=
browser
.
MustPage
(
cafeUrl
)
.
MustElement
(
"iframe#cafe_main"
)
time
.
Sleep
(
time
.
Second
*
2
)
source
:=
frame
.
MustFrame
()
.
MustHTML
()
html
,
err
:=
goquery
.
NewDocumentFromReader
(
bytes
.
NewReader
([]
byte
(
source
)))
...
...
Please
register
or
login
to post a comment