Created
November 27, 2008 02:28
-
-
Save elecnix/29667 to your computer and use it in GitHub Desktop.
Download railscasts.com archive
This file contains 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
require 'rubygems' | |
require 'mechanize' | |
require 'net/http' | |
agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
end | |
archive = agent.get("http://railscasts.com/episodes/archive") | |
episodes = archive.links.select do |link| | |
link.uri.to_s.include? "/episodes/" | |
end | |
episodes.each do |link| | |
puts link.uri | |
episode = agent.get(link.uri) | |
movie = episode.links.select {|link| link.uri.to_s.include? ".mov" }[0] | |
`wget -q -N #{movie.uri}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment