Skip to content

Instantly share code, notes, and snippets.

@elecnix
Created November 27, 2008 02:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elecnix/29667 to your computer and use it in GitHub Desktop.
Save elecnix/29667 to your computer and use it in GitHub Desktop.
Download railscasts.com archive
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