avijohnson
8/6/2014 - 6:51 AM

gistfile1.txt

require 'rubygems'
require 'nokogiri'
require 'open-uri'

base_url = "http://www.kicksonfire.com"
list_url = "#{base_url}/rare-kicks/" 
doc = Nokogiri::HTML(open(list_url)) 

x = []

l = doc.css(".entry a").map { |link| link['href'] }
l.each do |url|
	if url.start_with?base_url 
		x.push(url)
	end
end

x.each do |href| 
	html = Nokogiri::HTML(open(href))
			
			

	detail = {}
	td = html.css("td")
	details = td.collect do |row|
		[
			[:model, td[1]],
		  [:colorway, td[3]],
		  [:stylecode, td[5]],
		  [:year, td[7]],
		  ].each do |name, item|
		    detail[name] = item.text
		  end
	end
	title = html.css("h2").text
	model = detail[:model]
	colorway = detail[:colorway]
	style_code = detail[:stylecode]
	year = detail[:year]
	description = html.css("p").text.gsub("Copyright © 2014 · KicksOnFire.com", "") 
end