Install Library

npm install axios cheerio iconv-lite -s

Crawling

const cheerio = require("cheerio");
const axios = require("axios");
const iconv = require("iconv-lite");
const url = "http://???????";

router.get("/??????", async (req, res) => {
  try {
    await axios({
      url: url,
      method: "GET",
      responseType: "arraybuffer",
    }).then(async (html) => {
      const content = iconv.decode(html.data, "EUC-KR").toString();
		// EUR-KR part is different from pages.
    });
    res.send({ result: "success", message: "크롤링이 완료 되었습니다." });
    
  } catch (error) {
    console.log(error)
    res.send({ result: "fail", message: "크롤링에 문제가 발생했습니다", error:error });
  }
  
});

router.get("/goods/add/crawling", async (req, res) => {
  try {
    await axios({
      url: url,
      method: "GET",
      responseType: "arraybuffer",
    }).then(async (html) => {
				const content = iconv.decode(html.data, "EUC-KR").toString();
				const $ = cheerio.load(content);
	      const list = $("ol li");
				await list.each( async (i, tag) => {
						let desc = $(tag).find("p.copy a").text() 
		        let image = $(tag).find("p.image a img").attr("src")
		        let title = $(tag).find("p.image a img").attr("alt")
		        let price = $(tag).find("p.price strong").text();

            console.log(desc, image, title, price);
        })
    });
    res.send({ result: "success", message: "크롤링이 완료 되었습니다." });
    
  } catch (error) {
    console.log(error)
    res.send({ result: "fail", message: "크롤링에 문제가 발생했습니다", error:error });
  }
});

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ce8f5cca-38f6-4938-a4ca-3776ccb49ac7/Screen_Shot_2021-06-29_at_4.05.22_PM.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/15c9b120-5368-4949-8809-fc8e49e0b573/Screen_Shot_2021-06-29_at_4.05.33_PM.png