Cheerio: Fast and Flexible HTML/XML Parsing and Manipulation Library

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Cheerio: Fast and Flexible HTML/XML Parsing and Manipulation Library

Summary

Cheerio is a popular library for parsing and manipulating HTML and XML documents in Node.js. It provides a jQuery-like API, making it easy to select, traverse, and modify elements with proven syntax. Known for its blazingly fast performance and incredible flexibility, Cheerio is an excellent choice for web scraping and server-side DOM manipulation.

Repository Information

Analyzed by OSRepos on May 13, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introdução

Cheerio is a lightweight and efficient library designed for parsing and manipulating HTML and XML documents. It brings a familiar jQuery-like syntax to the server-side, allowing developers to interact with the DOM without the overhead of a full browser environment. Built with speed and flexibility in mind, Cheerio is an ideal tool for tasks such as web scraping, content parsing, and server-side rendering. It leverages parse5 for robust HTML parsing and can optionally use htmlparser2.

Instalação

To get started with Cheerio, you can install it using your preferred package manager:

npm install cheerio
# or
bun add cheerio

Exemplos

Here's a quick example demonstrating how to load HTML, manipulate elements, and render the result:

import * as cheerio from 'cheerio';
const $ = cheerio.load('<h2 class="title">Hello world</h2>');

$('h2.title').text('Hello there!');
$('h2').addClass('welcome');

$.html();
//=> <html><head></head><body><h2 class="title welcome">Hello there!</h2></body></html>

This snippet shows how easy it is to select elements using CSS selectors, modify their text content, add classes, and then retrieve the updated HTML.

Porquê usar

Cheerio stands out for several compelling reasons:

  • Proven Syntax: It implements a subset of core jQuery, offering a familiar and powerful API without browser inconsistencies.
  • Blazingly Fast: With a simple and consistent DOM model, Cheerio ensures incredibly efficient parsing, manipulation, and rendering.
  • Incredibly Flexible: Wrapping around parse5 and optionally htmlparser2, Cheerio can parse nearly any HTML or XML document and works seamlessly in both browser and server environments.

Links

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️