Skip to content

Instantly share code, notes, and snippets.

@davidbody
Created May 14, 2009 22:56
Show Gist options
  • Save davidbody/111976 to your computer and use it in GitHub Desktop.
Save davidbody/111976 to your computer and use it in GitHub Desktop.
Scrape RailsConf 2009 presentations
#!/usr/bin/env ruby
require 'rubygems'
require 'curb'
require 'webrat'
Webrat.configure { |config| config.mode = :mechanize }
session = Webrat.session_class.new
session.visit "http://en.oreilly.com/rails2009/public/schedule/proceedings"
session.dom.search(".en_session_downloads a").each do |link|
url = URI.escape(link['href'])
filename = "download/" + URI.unescape(url.split(/\//).last)
unless File.exists?(filename)
puts "Downloading #{url} to #{filename}"
Curl::Easy.download(url, filename)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment