Skip to content

Instantly share code, notes, and snippets.

@hwatkins
Created March 20, 2013 17:44
Show Gist options
  • Save hwatkins/5206779 to your computer and use it in GitHub Desktop.
Save hwatkins/5206779 to your computer and use it in GitHub Desktop.
Check availability on powder valley
require 'rubygems'
require 'nokogiri'
require 'open-uri'
pages= %w[CCIprimers REMprimers WINprimers accurate alliant hodgdon BEBullets HPBullets SPPBullets]
pages.each do |page|
doc = Nokogiri::HTML(open("http://www.powdervalleyinc.com/#{page}.shtml"))
doc.xpath('//form//table//tr').each_with_index do |row, index|
next if index < 2
row.xpath('td').each do |cell|
print '"', cell.text.gsub("\n", ' ').gsub('"', '\"').gsub(/(\s){2,}/m, '\1'), "\", "
end
print "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment