A collection of web scraping examples written in Node.js. Ordered from simplest to increasingly complicated.
View the presentation on Google Slides
- Clone repo
- Run
npm install
- Rename default.env to .env and fill in the provided blanks
The most simple example, performs a HTTP GET request to a site and prints the HTML content to the console.
Run with node example1.js
Building on Example 1, we use the cheerio library to parse the HTML and get a collection of results.
Directly adding on to example 2 by adding SendGrid email support. Does a simple text match on a vehicle and sends the results in an HTML email.
Example 3 is the most complicated. 3 sets of requests are made:
- Gets the number of pages
- Hits each page once to get a list of vehicles identification numbers
- Sends each VIN to an endpoint to get vehicle data