Cheerio icon

Cheerio

Parse HTML using Cheerio

Cheerio

AI-generated

Summary

Parse HTML and extract text or attribute values using CSS selectors, with options to trim whitespace, return single items, return HTML, and remove unwanted elements before parsing.

Inputs

  • html (required) — The HTML to parse
  • selectors (required) — The CSS selectors to use; at least one selector is required at runtime, otherwise the node throws an error
  • removeElements — Comma-separated CSS selectors for elements to remove before parsing (e.g. 'script, style, nav, footer')

Output shape

array

Returns an array containing a single JSON object with results, totalElements, and selectors count. Throws an error if no selectors are provided.

Discussion