Northern Pileated Marmoset


    1.0.9 • Public • Published

    price-monitoring NPM Version JavaScript Style Guide

    Node.js price monitoring library, leveraging the power of x-ray and nightmare.


    • Leverage the power of x-ray, nightmare and cheerio.
    • Electron based headless-engine that accepts JS and follows redirects.
    • Parse Products starting from a CSV file.
    • Modular structure for Website parser (MyEcommerce that extends SiteParser).
    • Bind every URL to an instance of the parsers. (A parser can handle multiple urls).
      • Check wether an url got his parser.


    $ npm install --save price-monitoring


    Product structure

      "name": "Samsung Evo microSD 32GB",
      "link": "",
      "price": 14.00,
      "variation": 10
    • name: product name or identifier.
    • link: absolute link to the product.
    • price: base price.
    • variation: price variation in % that triggers the priceAlert event.
    • customSelector: [optional] provide a custom selector for a given product instead of using the one of your custom parser.

    Get it from a CSV

    You can easily provide a CSV list of products.

    name, link, price, variation
    Samsung Evo microSD 32GB,,14.00,10

    Main flow

    var PriceMonitoring = require('price-monitoring')
    var pm = new PriceMonitoring({
      parsersDir: path.join(__dirname, 'myParsers/'), // add parsers
      interval: 60 * 1000 // check prices every min
    pm.on('priceAlert', function(product, newPrice){
      // do whatever you want
      // ...
    /* Add the products from CSV */
    pm.parseCSV(fileInput) // fileInput can be a csv file path or a Buffer
    // or manually
      name: 'Special price product',
      link: '',
      price: 249.99,
      variation: 18

    Every parser works in Parallel, and products prices are fetched sequentially.

    The parsersDir property is mandatory. Check out a fully-working sample in the example/ dir.


    parseAndSubmit(<Object>, <fn>)

    Parse and submit a product to his own parser instance. The product object should follow the structure explained above. The callback will return true or false depending on the submission outcome.

    removeProduct(<Object>/<link>, <fn>)

    Remove the product from his own parser instance matching the given product obj or link. The callback will return true or false if the product link match a registered parser.


    Fetch and parse all the products from the provided CSV file or Buffer. It returns a Promise.


    The cb is called once all the prices for all the Parsers have been retrieved.


    Start watching for Prices, the callback is called once all the parsers retrieved all the products prices. The callback returns the current round number. If called multiple times it will not take effect.


    Returns true if the price watch operation is running, false otherwise.


    Stop the prices' watch.


    Close all the nightmareDrivers from the parsers' instances. (This avoids zombie processes).


    Returns an Array of the all the Parsers loaded in the current instance of PriceMonitoring with all the submitted products.


    Returns the number of site-parsers loaded.


    Returns the number of products added.


    Returns an array of all the inserted products.


    Check wether a given website url has his own parser loaded or not.


    .on('error', cb)

    Triggered in case of error. cb accepts one param, error.

    .on('submit', cb)

    Triggered when a new product is submitted in a parser' instance. The cb accepts one param, product. (The product being submitted).

    .on('skip', cb)

    Triggered when a product is skipped (no suitable parser found). The cb accepts one param, product. (The product being skipped).

    .on('priceFetched', cb)

    Triggered when a new price has been fetched for a given product. The cb accepts 2 params: product, price.

    .on('priceAlert', cb)

    Triggered when a product's price is outside the variation% threshold. The cb accepts 2 params: product, newPrice.

    .on('parserEnd', cb)

    Called when a parser ends his price-fetch process for all his products. The cb accepts 2 params: site, nProducts. Respectively the website and the number of products involved.

    Build a custom website parser

    It's quick:

    const SiteParser = require('price-monitoring').SiteParser
    /* Class */
    class MyEcommerce extends SiteParser {
      constructor () {
          '', // base url
          '.pricing .price@html | trim | slice:-5 | replaceComma | float' // price selector
    module.exports = MyEcommerce

    That's it. Then don't forget to put your parsers in a directory and give it as parsersDir property to your currente PriceMonitoring instance.

    Available filters

    • trim: trim the given string.

    • reverse: reverse the given string.

    • join:<sep>: join the string using the given sep separator.

    • slice:<start>,<end>: split the string from start to end indexes.

    • split:<sep>,<index>: split for the given sep separator and return the elem. at the index.

    • replaceComma: Replace the , char with ., useful to make the price string parsable.

    • float: Cast the given string to float.

    Test our website parser in an isolate-manner

    var p = new AmazonIT()
    p.on('error', console.log)
    p.on('submit', console.log)
    p.on('priceFetched', function(product, currentPrice){
      console.log(, 'got', currentPrice)
    p.on('priceAlert', function(product, newPrice){
      console.log('Alert!',, 'got', newPrice)
    p.on('end', function(){
        name: 'Special price product',
        link: '',
        price: 20.5,
        variation: 15
        name: 'Normal price product',
        link: '',
        price: 14.00,
        variation: 17


    Still in Beta


    Rocco Musolino




    npm i price-monitoring

    DownloadsWeekly Downloads






    Unpacked Size

    26.2 kB

    Total Files


    Last publish


    • roccomuso