Skip to content

Instantly share code, notes, and snippets.

@erlinis
Created March 10, 2015 22:20
Show Gist options
  • Save erlinis/7a411686fc1a28544df7 to your computer and use it in GitHub Desktop.
Save erlinis/7a411686fc1a28544df7 to your computer and use it in GitHub Desktop.
scrapping apple device specs
require 'mechanize'
agent = Mechanize.new
agent.get("http://www.everyi.com/by-identifier/ipod-iphone-ipad-specs-by-model-identifier.html")
items = agent.page.parser.css("#contentcenter>#contentcenter_specs_externalnav_wrapper")
ipad_spec = []
items.each do |item|
specs = item.search("#contentcenter_specs_externalnav_noflip_2>a").text
model = item.search("#contentcenter_specs_externalnav_noflip_3>a").text
ipad_spec.push({ model: model, specs: specs }) if (!model.empty?)
end
puts JSON.generate(ipad_spec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment