Fetching Railscasts with Hpricot
In the spirit of why’s original nostrils , I’ve made a small Hpricot script to fetch me a set of screencasts from Railscasts
1 2 3 4 5 6 7 8 9 10 11 |
require 'rubygems' require 'hpricot' require 'open-uri' uri='http://railscasts.com/episodes/' from,to=*ARGV.map { |arg| arg.to_i } (from..to).to_a.each do |ep| doc = Hpricot(open("#{uri}#{ep}")) puts (doc/'div.download').first.at('a')['href'] end |
Then invoke by
ruby railscasts_downloader.rb 15 20 | xargs -n1 wget