Created
September 11, 2009 18:44
-
-
Save eric1234/185497 to your computer and use it in GitHub Desktop.
Will slurp media attached to audio/video podcasts.
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 | |
# 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