Download the Kleptones 24 Hours using Ruby
March 28, 2006
Go get http://www.kleptones.com/pages/downloads_24h.html!
Due to the lack of working torrent files i wrote a nifty little ruby script to fetch all the mp3 files (works on OSX and RedHat, your mileage may vary).
Just type "ruby download_kleptones.rb" and all the mp3 files are being downloaded into a "Kleptones_24hours" directory.
See the kleptones blog for more information.
# == Synopsis # Download all the MP3 files of the Kleptones "24hours" # # == Usage # ruby download_kleptones.rb # # You may have to install the "RIO gem" (sudo gem install rio) in order # to use this script. # == Author # Stefan Saasenrequire 'rubygems' require 'rio' require 'cgi' path = 'http://www.kleptones.com/pages/' mp3_dir = "./Kleptones_24hours" content = "" # Fetch the HTML page rio(path + 'downloads_24h.html') > content # mkdir Dir.mkdir(mp3_dir) unless File.directory?(mp3_dir) # get all links content.scan(/]*href="([^"]+)"[^>]*>/) do |link| # skip links next unless link.to_s =~ /24h\// filename = link.to_s.split("/").last print "fetching " + CGI::unescape(filename) + "\n" rio(URI(path + link.to_s)) > rio(mp3_dir + "/" + filename) end