Price Notifier

by simonneutert

GitHub Readme.md

Automated Sinatra based Price Checker/Watcher for heroku

uses heroku's free scheduler add-on to let you know when the price drops

You can either use the heroku deploy button or deploy manually.

Heroku Button

  • Click this button and deploy your app instance. If you have no heroku account yet, sign up now - it's free! When successful, hit manage your new app.

    Deploy

  • Go to Settings and click Reveal Config Vars.

    Edit the Values for: SMTP_SERVER, SMTP_PORT, SMTP_DOMAIN, SMTP_LOGIN, SMTP_PASSWORD, AUTHMETHOD, SENDER and RECIPENT

  • Do not forget to restart the dyno after successful configuration of the environment's configuration variables.

  • Then go to Resources and click Heroku Scheduler. There you can add rake tasks, daily tasks are sufficient.

    A working rake task example:

    rake check_price URL=https://www.rosebikes.de/bike/rose-x-lite-crs-force/aid:886264 DOM_ELEMENT=div#product_price PRICE_LIMIT=9999
    

    Rake Task Arguments

    URL url to the product

    DOM_ELEMENT that identifies the price tag. Either pass an element and ID such as div#product_price or access via class e.g. div.price.orange (only the first is taken).

    PRICE_LIMIT must be an Integer!

Manual Setup

local (on your machine)

  • download repository
  • install chromedriver and Google Chrome
  • bundle
  • edit email settings in mailer.rb (or set the ENV Vars on heroku when deployed)
    # mailer.rb
    #
    # for more info about email configuration, see:
    # http://ruby-doc.org/stdlib-2.0.0/libdoc/net/smtp/rdoc/Net/SMTP.html
    smtp_server = ENV['SMTP_SERVER'] || 'mail.mailserver.com' # mail server domain of your provider
    smtp_port = ENV['SMTP_PORT'].to_i || 587
    domain = ENV['SMTP_DOMAIN'] || 'yourdomain.com'
    login = ENV['SMTP_LOGIN'] || 'username@email.de'
    password = ENV['SMTP_PASSWORD'] || 'secretpassword'
    authmethod = ENV['AUTHMETHOD'] || :plain # see docs (link above)
    sender = ENV['SENDER'] || "youremail@fromdomain.de"
    recipent = ENV['RECIPENT'] || "recipent@domain.de"

heroku

  • upload project to heroku

  • add scheduler to heroku project

    $ heroku addons:create scheduler:standard

  • Spot your product

    • save your desired product's unique url
    • then identify the (css) id of the price element
  • visit your heroku dashboard and add rake tasks to your free scheduler add-on. An Example:

    rake check_price URL=https://www.rosebikes.de/bike/rose-x-lite-crs-force/aid:886264 DOM_ELEMENT=div#product_price PRICE_LIMIT=9999
    

    Rake Task Arguments

    URL url to the product

    DOM_ELEMENT that identifies the price tag. Either pass an element and ID such as div#product_price or access via class e.g. div.price.orange (only the first is taken).

    PRICE_LIMIT must be an Integer!

Pull Requests

Help and improvements are welcome 😁

Let's make sniping products when cheap a breeze :octocat: