Skip to content

Instantly share code, notes, and snippets.

@eric1234
Created September 11, 2009 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eric1234/185497 to your computer and use it in GitHub Desktop.
Save eric1234/185497 to your computer and use it in GitHub Desktop.
Will slurp media attached to audio/video podcasts.
#!/usr/bin/env ruby
# Will slurp all the media attached to a audio/video podcasts. USAGE:
#
# ruby -rrubygems podcast_slurp.rb http://feeds.feedburner.com/railscasts railscasts
$VERBOSE = true
require 'open-uri'
require 'nokogiri'
rss = Nokogiri::XML(open(ARGV.first))
rss.search('item enclosure').collect do |e|
output = File.join ARGV.last, File.basename(e['url'])
File.open(output, 'wb') {|f| f << open(e['url'], 'rb').read}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment