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
3515ba65
Commit
3515ba65
authored
Jan 14, 2021
by
baesangjune
Browse files
.
parent
fae4ae5a
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
googlez.txt
0 → 100644
View file @
3515ba65
This diff is collapsed.
Click to expand it.
server/controllers/review.controller.js
View file @
3515ba65
...
@@ -11,19 +11,18 @@ const search = async (req, res) => {
...
@@ -11,19 +11,18 @@ const search = async (req, res) => {
const
editUrl
=
/
(
http
(
s
)?
:
\/\/)([
a-z0-9
\w]
+
\.
*
)
+
[
a-z0-9
]{2,4}
/gi
const
editUrl
=
/
(
http
(
s
)?
:
\/\/)([
a-z0-9
\w]
+
\.
*
)
+
[
a-z0-9
]{2,4}
/gi
axios
.
get
(
url
)
axios
.
get
(
url
)
// .then(anyToUtf8)
// .then(anyToUtf8)
.
then
((
html
)
=>
{
.
then
((
response
)
=>
{
// fs.writeFileSync("googlez.txt", '\ufeff' + html, { encoding: 'utf8' });
const
html
=
response
.
data
let
$1
=
cheerio
.
load
(
html
.
data
);
fs
.
writeFileSync
(
"
googlez.txt
"
,
html
,
{
encoding
:
'
utf8
'
});
let
$1
=
cheerio
.
load
(
html
);
let
reviews
=
[]
let
reviews
=
[]
$1
(
'
.kCrYT
'
).
each
(
function
(
i
)
{
$1
(
'
.kCrYT
'
).
each
(
function
(
i
)
{
let
link
=
""
if
(
$1
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
))
{
if
(
$1
(
this
).
find
(
'
h3
'
).
text
())
{
link
=
(
$1
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
)).
match
(
editUrl
)
reviews
[
i
]
=
{
title
:
$1
(
this
).
find
(
'
h3
'
).
text
(),
link
:
(
$1
(
this
).
find
(
'
a
'
).
attr
(
'
href
'
))
}
}
}
else
if
(
$1
(
this
).
find
(
'
.s3v9rd
'
).
find
(
'
.s3v9rd
'
).
text
())
{
reviews
[
i
]
=
{
reviews
[
i
-
1
]
=
{
...
reviews
[
i
-
1
],
summary
:
$1
(
this
).
find
(
'
.s3v9rd
'
).
find
(
'
.s3v9rd
'
).
text
()
}
title
:
$1
(
this
).
find
(
'
h3
'
).
text
(),
reviews
=
reviews
.
filter
(
e
=>
e
)
link
:
link
,
summary
:
$1
(
this
).
find
(
'
.s3v9rd
'
).
find
(
'
.s3v9rd
'
).
text
(),
}
}
})
})
// reviews.forEach((review, i) => {
// reviews.forEach((review, i) => {
...
@@ -36,7 +35,7 @@ const search = async (req, res) => {
...
@@ -36,7 +35,7 @@ const search = async (req, res) => {
// })
// })
// })
// })
console
.
log
(
reviews
)
console
.
log
(
"
*******************************************
"
,
reviews
)
res
.
send
(
reviews
)
res
.
send
(
reviews
)
})
})
// function anyToUtf8(str) {
// function anyToUtf8(str) {
...
...
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