Download RailsConf 2007 Presentations 5

Posted by Lee Marlow Mon, 21 May 2007 18:27:00 GMT

Updated: Now more bloated!

Run this to get the RailsConf 2007 presentations:
#!/usr/bin/env ruby

require 'rubygems'
require 'hpricot'
require 'open-uri'

base = 'http://www.web2expo.com'
h = Hpricot(open("#{base}/pub/w/51/presentations.html"))

h.search('div .presentation > a[@href^="/presentations/rails2007/"]').each do |a|
  url = "#{base}#{a[:href]}"
  if File.exists?(File.basename(url))
    puts "skipping #{url}... already downloaded"
  else
    puts "downloading #{url}..."
    `wget --quiet #{url}`
  end
end
I might clean it up more later to name the files better and not use wget, but this was quick and easy... not to mention a way to use everyone's favorite parsing tool: Hpricot.
Comments

Leave a response

  1. Dr J Mon, 21 May 2007 19:31:49 GMT

    excellent!!

    wish I was in Portland for it

  2. Werner Ramaekers Mon, 21 May 2007 19:35:53 GMT

    If you want to run this from a mac running OSX then replace : `wget—quiet #{url}` with : `curl—silent #{url}`

  3. Werner Ramaekers Mon, 21 May 2007 19:44:03 GMT

    If you want to run this from a mac running OSX then replace : `wget—quiet #{url}` with : `curl -O—silent #{url}`

  4. Preston Lee Mon, 21 May 2007 21:06:14 GMT

    Cool hack. I did something similar this morning, and am hosting a single .zip download which include stuff not present on the web2expo website..

    http://www.prestonlee.com/archives/117

  5. Preston Lee Mon, 21 May 2007 21:06:15 GMT

    Cool hack. I did something similar this morning, and am hosting a single .zip download which include stuff not present on the web2expo website..

    http://www.prestonlee.com/archives/117

Comments