As an alternative to Cheerio, there is more lightweight approach — parse HTML into a simple AST and traverse it with standard javascript Array/Object methods.

I found it more suitable for stateless Node.js environment where you just want to get some information buried somewhere in some specific place in HTML. On contrary, in the browser, you often need to store instances of the DOM nodes and manipulate them.

There is a number of good HTML to AST parsers:

Especially for a high-load projects, I would definitely check this approach.

Written by

I build apps for Web and Apple platforms. https://twitter.com/mykola_harmash

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store