Download wallpapers from www.skins.be
From CodeCodex
Save it as a file.rb and run it as ruby file.rb url
require 'rubygems' require 'mechanize' =begin skins.be wallpaper scrapper: You provide it with the URL on the command line such as http://skins.be/<model_name>/wallpapers/ and it automatically downloads the wallpapers with the highest resolution from every available page. Written by an annonymous noob programmer. I hope this helps you as much as it helped me learn Ruby, Xpath and WWW::Mechanize. =end agent = WWW::Mechanize.new agent.user_agent = "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.276.0 Safari/532.8" mainpage = agent.get ARGV[0] pages = {mainpage.uri => mainpage} mainpage.search("//div[@id='pagination']/a").each do |a| page = agent.get a['href'] if !pages.has_key?(page.uri) then pages[page.uri] = page end end puts "We have #{pages.size} pages to parse" pages.each do |k,page| puts "" puts "Next page: #{k}" page.search("//ul[@class='resolutionListing']/li[last()]/a").each do |anchor| imagepage = agent.get anchor['href'] imagepage.search("//img[@id='wallpaper_image']").each do |image| puts "Saving image: #{image['src']}" agent.get(image['src']).save end end end puts "Finished!"