πŸ› (Amazon.in) Price Tracker using Puppeteer

πŸ› (Amazon.in) Price Tracker using Puppeteer

Β·

2 min read

Play this article

JavaScript quick-start project for amazon.in price tracking.

πŸ›  Tools required to develop the price-tracker

  • NodeJs
  • Puppeteer
  • SendGrid/Mail
  • CronJob

🀝 Requirements

In order to utilise this project you need to have the following installed locally:

To install the dependencies locally run:

npm install dependencies

In order for the price tracking to pass, you will need to configure the script with the following parameters:

  • Setup/Replace the to and from email addresses in the sendEmail() function
function sendEmail(subject, body) {
  const email = {
    to: "*****@yourmail.com",
    from: "*****@yourmail.com",
    subject: subject,
    text: body,
    html: body,
  };
  return sgMail.send(email);
}
  • Setup/Replace the sendgrid api key from the sendgrid account, and place it locally in a .env file.
SENDGRID_API_KEY= *****
  • Setup/Replace the cron job with desired time interval in the startTracking() function
async function startTracking() {
  const page = await configureBrowser();

  let job = new CronJob(
    "* */30 * * * *",
    function () {
      //runs every 30 minutes in this config
      checkPrice(page);
    },
    null,
    true,
    null,
    null,
    true
  );
  job.start();
}

πŸ‘·β€β™‚οΈ Usage

The project is basically a Nodejs script that can be run from the command line. In order to run this locally you need to clone the project and set up requirements and run the command:

node track <amazon.in-url-to-track> <price-threshold>
  • amazon.in-url-to-track is the url of the product you want to track
  • price-threshold is the price limit you want to track for the product

πŸ“Ή Demo Video

πŸ€– Template Repository

Price Tracker

Did you find this article valuable?

Support Milind Mishra by becoming a sponsor. Any amount is appreciated!

Β