Guest User

Untitled

a guest
Sep 22nd, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.43 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'xmlsimple'
  4. require 'open-uri'
  5. require 'fileutils'
  6.  
  7. xml = open('http://feeds.feedburner.com/NintendoNowBlogspotPodcast').read
  8. hash = XmlSimple.xml_in(xml)
  9.  
  10. url = hash['channel'][0]['item'][0]['enclosure'][0]['url']
  11.  
  12. temp = open(url)
  13. show_num = url[url.length - 7, 3]
  14. item_fname = "gnpodcast_" + show_num + ".mp3"
  15. new_path = File.expand_path(item_fname, "~/Desktop")
  16. FileUtils.mv(temp.path, new_path)
Advertisement
Add Comment
Please, Sign In to add comment