Posted By

hafthor on 12/27/10


Tagged

ruby


Versions (?)

Create CURL batch to download all Microsoft SQL MCM prep videos


 / Published in: Ruby
 

URL: http://technet.microsoft.com/en-us/sqlserver/ff977043.aspx

ruby mcm.rb >mcm.sh chmod +x mcm.sh ./mcm.sh

  1. # MCM Video Home - http://technet.microsoft.com/en-us/sqlserver/ff977043.aspx
  2. # Thanks to @PaulRandal and @KimberlyLTripp
  3. #
  4. require 'rss'
  5. require 'open-uri'
  6. rss=nil
  7. open('http://www.microsoft.com/feeds/TechNet/en-us/How-to-videos/SQL_Server_2008_Microsoft_Certified_Master_(MCM)_Readiness_Videos.xml') do |f|
  8. rss = RSS::Parser.parse(f.read, false)
  9. end
  10. rss.items.each do |item|
  11. open(item.link) do |f|
  12. t=f.read
  13. u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*mp4video[\(\)\_A-Za-z0-9\/-]*\.m4v/).first
  14. u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*m4v[\(\)\_A-Za-z0-9\/-]*\.m4v/).first unless u
  15. puts 'curl "'+u+'" >"' + u.scan(/MCM_[\_A-Za-z0-9\(\)\/-]*\.m4v/).first + '"'
  16. end
  17. end

Report this snippet  

You need to login to post a comment.