A Java library for parsing, scraping, editing and sanitizing real-world HTML using DOM methods, CSS selectors and XPath.
cheeriojs/cheerio
Fast, jQuery-style library for parsing and manipulating HTML and XML documents on the server or in the browser.
- Stars
- 30,534
- Forks
- 1,746
- Open issues
- 81
- Last commit
- 23 hours ago
What is it?
Cheerio is a Node.js library for working with HTML and XML documents. It lets you load a document as a string and query it with jQuery-style selectors, then read, change, or render the resulting tree without a browser.
Cheerio implements a subset of core jQuery methods, so developers familiar with jQuery can select elements and modify attributes, classes, and text with the same calls. It parses through parse5 by default and can optionally use the more forgiving htmlparser2 for loose or malformed markup. The library runs in both server and browser environments and is installable through npm, yarn, bun, or Deno.
Key features
- 01Supports jQuery-style selectors and a subset of jQuery methods.
- 02Parses HTML and XML, with parse5 or the forgiving htmlparser2 as backends.
- 03Reads and modifies attributes, classes, text, and child nodes.
- 04Renders the modified document or the outerHTML of any selection.
- 05Works in both browser and server environments.
Use cases
- Scraping and extracting data from web pages in Node.js.
- Transforming HTML templates or content during a build step.
- Manipulating HTML server-side without launching a headless browser.
- Parsing XML documents with a familiar selector syntax.
Quick start
- 1
Install Cheerio with npm
npm install cheerio - 2
Import and load an HTML string, then use jQuery-style selectors
Things to know
- Implements only a subset of jQuery's API, so some jQuery methods are unavailable.
Topics
FAQ
- What is cheerio?
- Fast, jQuery-style library for parsing and manipulating HTML and XML documents on the server or in the browser. Cheerio is a Node.js library for working with HTML and XML documents. It lets you load a document as a string and query it with jQuery-style selectors, then read, change, or render the resulting tree without a browser.
- Is cheerio free to use? What license does it have?
- cheerio is open source under the MIT license. Check the license terms before using it in commercial products.
- Is cheerio still maintained?
- Actively maintained. The last commit to cheerio was on Nov 6, 2026.
- What can I use cheerio for?
- Scraping and extracting data from web pages in Node.js. Transforming HTML templates or content during a build step. Manipulating HTML server-side without launching a headless browser. Parsing XML documents with a familiar selector syntax.
- How do I install cheerio?
- Install Cheerio with npm: npm install cheerio Import and load an HTML string, then use jQuery-style selectors
- Where can I get cheerio?
- The source code and installation instructions are on GitHub: https://github.com/cheeriojs/cheerio
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A lightweight pure-Go package that parses, queries, modifies and writes XML as an element tree, with XPath-like path queries.
A pure-JavaScript implementation of WHATWG DOM and HTML standards for running a headless DOM environment in Node.js.
An MCP server that gives AI assistants web search via DuckDuckGo and readable text extraction from one or more URLs.
Scrapy is a Python web scraping and crawling framework for extracting structured data from websites.
A JavaScript toolkit for rendering and editing BPMN 2.0 process diagrams in the browser.