Created
March 10, 2015 22:20
-
-
Save erlinis/7a411686fc1a28544df7 to your computer and use it in GitHub Desktop.
scrapping apple device specs
This file contains 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 '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