v0.103.0: `cheerio` is now deprecated
The api.cheerio library is deprecated and will be removed in a future version.
Reasoning#
Cheerio is only used for the scripting API while the server internally uses node-html-parser for HTML parsing. Removing cheerio reduces bundle size and maintenance overhead.
Migration#
Before (cheerio):
const $ = api.cheerio.load(html);
const title = $('h1').text();
const links = $('a').map((i, el) => $(el).attr('href')).get();After (htmlParser):
const root = api.htmlParser.parse(html);
const title = root.querySelector('h1')?.textContent;
const links = root.querySelectorAll('a').map(a => a.getAttribute('href'));