Skip to content

Instantly share code, notes, and snippets.

@haeky
Last active August 29, 2015 14:00
Show Gist options
  • Save haeky/11360960 to your computer and use it in GitHub Desktop.
Save haeky/11360960 to your computer and use it in GitHub Desktop.
Checking if the new Pebble Steel is out.
require 'nokogiri'
require 'watir'
require 'open-uri'
require 'pry'
class Tweetbot
def parse_website
browser = Watir::Browser.new :phantomjs
browser.goto('https://getpebble.com/checkout')
document = Nokogiri::HTML.parse(browser.html)
div = document.css('div.steel_black')
puts 'Pebble Steel is now out <3' unless div.attr('class').value.include?('backordered')
end
end
bot = Tweetbot.new
bot.parse_website
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment