nick.recoil.org

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

Search

Sections

About Nick

I am a freelance technology consultant and developer working in London, with a particular interest in web development and video media.

This site contains my thoughts about technology, the universe and everything. If you would like to get in contact, have a look at the About me page.