Skip to content

Instantly share code, notes, and snippets.

@D3MZ
Created May 26, 2013 02:48
Show Gist options
  • Save D3MZ/5651537 to your computer and use it in GitHub Desktop.
Save D3MZ/5651537 to your computer and use it in GitHub Desktop.
#For Growth Hacking Services/Consulting, feel free to shoot me an Email :)
#Author: Demetrius Michael
#Contact: arrrwalktheplank (at) gmail.com
#http://www.demetriusmichael.com/
require 'mechanize'
require 'peach'
require 'pathname'
def get_images_from_ page
page.search('.restore img').
select { |x| x.attributes["onload"].value == "NcodeImageResizer.createOn(this);" if x.attributes["onload"] }
end
urls = (1..33).collect { |n| "http://www.audizine.com/forum/showthread.php/332328-***-OFFICIAL-B8-A4-Wheel-Gallery-***/page#{n}" }
a = Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
}
images = []
urls.pmap(10) do |url|
page = a.get url
images += get_images_from_ page
end
images = images.flatten.uniq
save_dir = ENV['HOME']+"/audiwheels/" rescue
Dir.mkdir(save_dir)
images.peach(10) do |image|
`wget #{image.attributes["src"].value} -O #{save_dir + Pathname.new(image.attributes["src"].value).basename.to_s}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment