Created
May 22, 2011 08:03
-
-
Save danhigham/985271 to your computer and use it in GitHub Desktop.
Script to download all Scotland Ruby 2011 videos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
dependencies = [:wget, :curl] | |
dependencies.each { |program| !`which #{program.to_s}`.empty? || STDERR.puts( "Requires #{program}") } | |
index_doc = Hpricot(open("http://confreaks.net/events/scotlandruby2011")) | |
video_links = (index_doc/".video .title a") | |
video_links.each do |a| | |
video_link = a.attributes['href'] | |
video_url = "http://confreaks.net#{video_link}" | |
video_html = `curl #{video_url}` #this fails with a 500 when using open-uri, not sure why | |
video_doc = Hpricot(video_html) | |
assets = (video_doc/".assets .asset-box a") | |
video = assets[0].attributes['href'] | |
`wget http://confreaks.net#{video}` | |
end |
kotp
commented
May 22, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment