![](/rp/kFAqShRrnkQMbH6NYLBYoJ3lq9s.png)
The industry standard for working with HTML in JavaScript | cheerio
2015年8月2日 · cheerio. The fast, flexible & elegant library for parsing and manipulating HTML and XML. Get Started!
Welcome to Cheerio! | cheerio - JS.ORG
Cheerio parses markup and provides an API for traversing/manipulating the resulting data structure. It does not interpret the result as a web browser does. Specifically, it does not produce a visual rendering, apply CSS, load external resources, or execute JavaScript which is common for a SPA (single page application).
Selecting Elements | cheerio - JS.ORG
Cheerio allows users to select elements from an HTML document using CSS selectors. This allows you to select elements based on criteria such as their tag name, class name, and attribute values. This guide provides an overview of how to use CSS selectors to retrieve elements.
Class: abstract Cheerio<T> - JS.ORG
The cheerio class is the central class of the library. It wraps a set of elements and provides an API for traversing, modifying, and interacting with the set. Loading a document will return the Cheerio class bound to the root element of the document.
Manipulating the DOM | cheerio - JS.ORG
In this guide, we will focus specifically on manipulating elements within a document using Cheerio. We will cover methods for modifying element attributes and properties, adding and removing classes, modifying text and HTML content, inserting …
Extracting Data with the extract Method | cheerio - JS.ORG
This uses Cheerio's prop method under the hood. value defaults to textContent , which extracts the text content of the element. As an attribute with special logic inside the prop method, href s will be resolved relative to the document's URL.
Loading Documents | cheerio - JS.ORG
The load method is the most basic way to parse an HTML or XML document with Cheerio. It takes a string containing the document as its argument and returns a Cheerio object that you can use to traverse and manipulate the document.
Traversing the DOM | cheerio - JS.ORG
Traversing a document with Cheerio allows you to select and manipulate specific elements within the document. Whether you want to move up and down the DOM tree, move sideways within the tree, or filter elements based on certain criteria, Cheerio …
Tutorials - Advanced | cheerio - JS.ORG
📄️ Configuring Cheerio. Configure Cheerio to work with different documents. 📄️ Extending Cheerio. Create custom pseudo-classes and plugins.
Extending Cheerio | cheerio - JS.ORG
Cheerio already provides many ways of working with documents, but sometimes you may want to add custom functionality. This guide will cover two approaches: adding custom CSS pseudo elements and writing plugins for Cheerio.