How to scrape the web data using cheerio in Node.js ?
Cheerio: Its working is based on jQuery. It’s totally working on the consistent DOM model. Cheerio is used for scraping web data sometimes and also used for automated tasks.
Approach: In this article, we scrapped the data of world meter a covid info website where we get the total confirmed cases total number of death, and total patients who are recovered till now.
Below is the step by step implementation:
Step 1: Enter the cmd and type the below command which will create the package.json file
Step 2: After creating the package, JSON file you need to install the cheerio, request and chalk from the below command:
npm install request cheerio chalk
Step 3: Now your Project directory looks like this:
Step 4:Now we create the index.js file and write the below code:
Output: Open the command prompt and enter the below command