Skip to content

thatbeautifuldream/price-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› (Amazon.in) Price Tracker

JavaScript quickstart project for amazon.in price tracking.

Tools

  • 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

price-tracker.mp4

Releases

No releases published

Packages

No packages published