Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서영
/
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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 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
);
...
...
@@ -94,6 +98,9 @@ search.naver = ( keywordText ) => {
result
=
getHtmlMain
(
naverMain
,
keywordText
,
html
,
naverURL
,
naver
);
resolve
(
result
);
})
.
catch
(
(
err
)
=>
{
throw
new
Error
(
err
);
});
})
}
...
...
@@ -110,6 +117,9 @@ search.google = ( keywordText ) => {
result
=
getHtmlMain
(
googleMain
,
keywordText
,
html
,
googleURL
,
google
);
resolve
(
result
);
})
.
catch
(
(
err
)
=>
{
throw
new
Error
(
err
);
});
})
}
...
...
Please
register
or
login
to post a comment