Created
June 13, 2013 12:47
-
-
Save matheusvetor/5773409 to your computer and use it in GitHub Desktop.
A ruby script for download all railscasts episodes from rss
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
#!/usr/bin/env ruby | |
begin | |
require 'rubygems' | |
rescue LoadError | |
end | |
require 'nokogiri' | |
require 'open-uri' | |
f = open('http://feeds.feedburner.com/railscasts') | |
episodes = Nokogiri::XML(f).root.xpath('channel').xpath('item') | |
episodes.each do |e| | |
c = e.at_xpath('enclosure') | |
url = c['url'] | |
name = url.match('videos.(.*)') | |
unless File.exists?(name[1]) | |
%x(wget -c #{url}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment