Skip to content

Instantly share code, notes, and snippets.

@matheusvetor
Created June 13, 2013 12:47
Show Gist options
  • Save matheusvetor/5773409 to your computer and use it in GitHub Desktop.
Save matheusvetor/5773409 to your computer and use it in GitHub Desktop.
A ruby script for download all railscasts episodes from rss
#!/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