
CHEERIO NPM HOW TO
This tutorial has provided an in-depth guide on how to get started using Cheerio in a real-life project.įor further reference, you can also check out the FeatRocket source code on GitHub.

CHEERIO NPM PLUS
Now, if we run node scrapper.js, you should see an output that looks like the below in your console:Ĭheerio is an excellent framework for manipulating and scraping markup contents on the server-side, plus it is lightweight and implements a familiar syntax. catch((err) => console.log("Fetch error " + err)) If you aren't using TypeScript you can omit the type declarations from the following code. For more info about using TypeScript with Node.js, read about how to compile TypeScript with npm. To get started, we need to run the npm init -y command, which will generate a new package.json file with its contents like below: `) To use the cheerio npm package we need to create a node script, and for this we can optionally use TypeScript.

Manipulating and rendering markup with Cheerio is incredibly fast because it works with a concise and simple markup (similar to jQuery).

In this article, we will be exploring Cheerio, an open source JavaScript library designed specifically for this purpose.Ĭheerio provides a flexible and lean implementation of jQuery, but it’s designed for the server. Traditionally, Node.js does not let you parse and manipulate markups because it executes code outside of the browser. Elijah Asaolu Follow I am a programmer, I have a life.
