Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bluejoyq
/
searchGuide
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-05 01:54:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8ce55ce5428ca6795a777ea82ead698d3926b570
8ce55ce5
1 parent
4675a060
search.js add error check
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
api/search.js
api/search.js
View file @
8ce55ce
...
...
@@ -63,8 +63,12 @@ const searchToResult = (searchResult, result, keywordCheck) => {
result
.
push
(
searchResult
);
}
}
else
if
(
keywordCheck
)
{
}}
// 공백 제거하고 비교
if
(
result
[
result
.
length
-
1
].
passage
.
replace
(
/
\s
/g
,
''
)
!==
searchResult
.
passage
.
replace
(
/
\s
/g
,
''
)
)
{
result
.
push
(
searchResult
);
}
}
}
const
getHtmlMain
=
(
main
,
keywordText
,
html
,
defaultURL
,
findSearchResult
)
=>
{
const
$
=
cheerio
.
load
(
html
);
...
...
@@ -93,7 +97,10 @@ search.naver = ( keywordText ) => {
.
then
(
(
html
)
=>
{
result
=
getHtmlMain
(
naverMain
,
keywordText
,
html
,
naverURL
,
naver
);
resolve
(
result
);
})
})
.
catch
(
(
err
)
=>
{
throw
new
Error
(
err
);
});
})
}
...
...
@@ -109,7 +116,10 @@ search.google = ( keywordText ) => {
.
then
(
(
html
)
=>
{
result
=
getHtmlMain
(
googleMain
,
keywordText
,
html
,
googleURL
,
google
);
resolve
(
result
);
})
})
.
catch
(
(
err
)
=>
{
throw
new
Error
(
err
);
});
})
}
...
...
Please
register
or
login
to post a comment