Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
search-page
Commits
fae4ae5a
Commit
fae4ae5a
authored
Jan 13, 2021
by
baesangjune
Browse files
머지확인
parent
1921d18c
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
client/.eslintcache
View file @
fae4ae5a
This diff is collapsed.
Click to expand it.
server/controllers/review.controller.js
View file @
fae4ae5a
...
@@ -4,7 +4,7 @@ import jschardet from 'jschardet'
...
@@ -4,7 +4,7 @@ import jschardet from 'jschardet'
// import iconv from 'iconv'
// import iconv from 'iconv'
import
fs
from
'
fs
'
import
fs
from
'
fs
'
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
const
Iconv
=
iconv
.
Iconv
//
const Iconv = iconv.Iconv
const
search
=
async
(
req
,
res
)
=>
{
const
search
=
async
(
req
,
res
)
=>
{
const
url
=
"
https://www.google.com/search?q=
"
+
encodeURI
(
req
.
params
.
search
)
+
"
+site%3Atistory.com&page_no=1
"
const
url
=
"
https://www.google.com/search?q=
"
+
encodeURI
(
req
.
params
.
search
)
+
"
+site%3Atistory.com&page_no=1
"
...
@@ -23,7 +23,7 @@ const search = async (req, res) => {
...
@@ -23,7 +23,7 @@ const search = async (req, res) => {
reviews
[
i
]
=
{
reviews
[
i
]
=
{
title
:
$1
(
this
).
find
(
'
h3
'
).
text
(),
title
:
$1
(
this
).
find
(
'
h3
'
).
text
(),
link
:
link
,
link
:
link
,
summary
:
$1
(
this
).
find
(
'
.s3v9rd
'
).
text
(),
summary
:
$1
(
this
).
find
(
'
.s3v9rd
'
).
find
(
'
.s3v9rd
'
).
text
(),
}
}
})
})
// reviews.forEach((review, i) => {
// reviews.forEach((review, i) => {
...
@@ -39,11 +39,11 @@ const search = async (req, res) => {
...
@@ -39,11 +39,11 @@ const search = async (req, res) => {
console
.
log
(
reviews
)
console
.
log
(
reviews
)
res
.
send
(
reviews
)
res
.
send
(
reviews
)
})
})
function
anyToUtf8
(
str
)
{
//
function anyToUtf8(str) {
const
{
encoding
}
=
jschardet
.
detect
(
str
);
// 웹페이지 문서의 인코딩 타입을 확인
//
const { encoding } = jschardet.detect(str); // 웹페이지 문서의 인코딩 타입을 확인
const
iconv
=
new
Iconv
(
encoding
,
"
utf-8//translit//ignore
"
);
// euc-kr 인코딩변환
//
const iconv = new Iconv(encoding, "utf-8//translit//ignore"); // euc-kr 인코딩변환
return
iconv
.
convert
(
str
).
toString
();
//
return iconv.convert(str).toString();
}
//
}
// try {
// try {
// const newPlace = await new Place({
// const newPlace = await new Place({
// name: req.params.search,
// name: req.params.search,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment