Commit fae4ae5a authored by baesangjune's avatar baesangjune
Browse files

머지확인

parent 1921d18c
This diff is collapsed.
......@@ -4,7 +4,7 @@ import jschardet from 'jschardet'
// import iconv from 'iconv'
import fs from 'fs'
import axios from 'axios';
const Iconv = iconv.Iconv
// const Iconv = iconv.Iconv
const search = async (req, res) => {
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) => {
reviews[i] = {
title: $1(this).find('h3').text(),
link: link,
summary: $1(this).find('.s3v9rd').text(),
summary: $1(this).find('.s3v9rd').find('.s3v9rd').text(),
}
})
// reviews.forEach((review, i) => {
......@@ -39,11 +39,11 @@ const search = async (req, res) => {
console.log(reviews)
res.send(reviews)
})
function anyToUtf8(str) {
const { encoding } = jschardet.detect(str); // 웹페이지 문서의 인코딩 타입을 확인
const iconv = new Iconv(encoding, "utf-8//translit//ignore"); // euc-kr 인코딩변환
return iconv.convert(str).toString();
}
// function anyToUtf8(str) {
// const { encoding } = jschardet.detect(str); // 웹페이지 문서의 인코딩 타입을 확인
// const iconv = new Iconv(encoding, "utf-8//translit//ignore"); // euc-kr 인코딩변환
// return iconv.convert(str).toString();
// }
// try {
// const newPlace = await new Place({
// name: req.params.search,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment