Skip to content

Instantly share code, notes, and snippets.

@hoverbird
Last active October 6, 2015 09:08
Show Gist options
  • Save hoverbird/2970005 to your computer and use it in GitHub Desktop.
Save hoverbird/2970005 to your computer and use it in GitHub Desktop.
Visually yours, Solstice and Equinox
require 'rubygems'; require 'mechanize'
agent = Mechanize.new
# Tor (of sci-fi and fantasy publishing fame) has been posting these great blog posts of art reminiscent of a given season. So far they've done summer, winter and spring. Run this script to get all of the art in tidy folders on your desktop.
seasons = [
'http://www.tor.com/blogs/2012/06/picturing-summer-a-solstice-celebration',
'http://www.tor.com/blogs/2011/12/picturing-winter-a-solstice-celebration',
'http://www.tor.com/blogs/2012/03/picturing-spring-an-equinox-celebration',
'http://www.tor.com/blogs/2012/09/picturing-autumn-an-equinox-celebration'
].map {|season| agent.get season}
agent.pluggable_parser.default = Mechanize::Download
seasons.each do |page|
images = page.parser.css('img.enlarge').map {|element| "http://www.tor.com" + element['src']}
images.each do |url|
puts "Found url #{url}"
agent.get(url).save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment