
favicon을 추출해본적이 있는가 ?
title 명과 favicon만 필요한 케이스를 가져와봤다
두 가지 라이브러리를 사용해봤는데
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
// Perform automation tasks
await browser.close();
})();
Puppeteer는 Node.js용 헤드리스 브라우저 자동화 라이브러리이다. DevTools 프로토콜을 통해 헤드리스 브라우저 또는 전체 브라우저를 제어하기 위한 고수준 API를 제공한다.
Puppeteer는 주로 브라우저 자동화 작업에 사용되며, 스크린샷 캡처, PDF 생성, JavaScript로 렌더링된 동적 콘텐츠 스크래핑 및 웹 페이지 상호 작용 자동화와 같은 작업에 적합하다.
const cheerio = require('cheerio');
const html = '<h1>Hello, <span>world</span>!</h1>';
const $ = cheerio.load(html);
$('h1').each((index, element) => {
console.log($(element).text());
});
정적 HTML 구문 분석 작업에 대해 가볍고 효율적이다.
기본 HTML 구문 분석 및 조작 작업에 대해 간단하다.