1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'rubygems'
require 'open-uri'
require 'hpricot'
require 'net/http'

@url = "http://www.rubyinside.com/scotland-on-rails-presentations-now-online-27-awesome-videos-1799.html"
@response = ''

open(@url, "User-Agent" => "Ruby/#{RUBY_VERSION}") do |f|
    @response = f.read
end

doc = Hpricot(@response)

(doc/"/html/body/div/div[2]/div/div/div/div[3]/ul/li").each do |list_item|
  (list_item/"a").each do |a|
    url_to_get = a.attributes['href']
    filename = "#{a.inner_html.downcase.gsub(/[:\s]/, '_')}.mp4"

    `wget #{url_to_get} -O #{filename}`
  end
end