Created
February 27, 2013 16:05
-
-
Save hwatkins/5049037 to your computer and use it in GitHub Desktop.
Simple script to show the availability of starline brass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby starline.rb | |
357-SIG-Brass 500 ($98.50) 1000 ($163.50) Available: 04/29/2013 | |
9MM-Brass | |
9MMP-Brass | |
380-Auto-Brass 500 ($73.00) 1000 ($129.00) Available: 04/16/2013 | |
40-SandW-Brass | |
45-Auto-P-Brass | |
45-Auto-Brass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
pages = %w[357-SIG-Brass 9MM-Brass 9MMP-Brass 380-Auto-Brass 40-SandW-Brass 45-Auto-P-Brass 45-Auto-Brass] | |
pages.each do |page| | |
wp = Nokogiri::HTML(open("https://www.starlinebrass.com/brass-cases/#{page}/")) | |
if wp.css("table i")[1] | |
available = wp.css("table i")[1].text | |
end | |
puts "#{page} #{wp.css("form#productForm option").text.sub(')', ') ')} #{available}" # => Nokogiri::HTML::Document | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment