Ruby on Rails

Depends how you interpret things

Category Archives: Ruby Crawlers

RailsCast’s Crawler – RubyScript

First of all thanks to RyanBates for his valuable contribution towards the rails community with those short and easy-to-understand railscast videos. From Past few months I continuously watching those videos. Yesterday while downloading one of those videos, I realize rather than downloading them when its needed, it better to write some very short & sweet script which will do that for me which giving me any trouble. After looking for some already existing rubyscripts on internet, I ended up writing my own.

require ‘rubygems’
require ‘hpricot’
require ‘open-uri’
class GetRailsCasts
def initialize
end
def start
1.upto(229){ |eps|
eps_doc = Hpricot(open(“#{@host}#{eps}”)) rescue nil
if eps_doc
# cd to the folder where u want to store the rails-cast videos
`cd /Users/sandy/railscasts; wget #{(eps_doc/”.download/a”).first[:href]}`
end
}
end
end
Comment are most welcome