hoodwink.d enhanced
 

juretta.com

Download the Kleptones 24 Hours using Ruby | March 28, 2006-->

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.

download_kleptones.rb:

# == 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 Saasen <s@juretta.com>
require '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(/<a[^>]*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

@16:29 | Comments: 1 | Tags: Ruby (32)

Diggman

1
pille says:
Avatar Tue Mar 28 23:10:51 +0200 2006 | #

hi susi,
hab mir die doppel lp auch gezogen;-)
sehr nett, also bei mir in iTunes…

About

juretta.com is the personal workspace of Stefan Saasen. You can send him an email or read more about this site in the „About“ section.

« Previous entry

Rdoc UTF-8
posted over 2 years ago

» Next entry

Gem remote search
posted over 2 years ago

Recent comment

On: “Attachr.com: OpenID support added

You need to kill this spam stuff!

posted about 1 year ago by entropie

Look!

Latest links  RSS  

More...