Return to Snippet

Revision: 38154
at January 2, 2011 02:50 by hafthor


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

Revision: 38153
at December 27, 2010 15:58 by hafthor


Updated Code
require 'rss'
require 'open-uri'
rss=nil
open('http://www.microsoft.com/feeds/TechNet/en-us/How-to-videos/SQL_Server_2008_Microsoft_Certified_Master_(MCM)_Readiness_Videos.xml') do |f|
  rss = RSS::Parser.parse(f.read, false)
end
rss.items.each do |item|
  open(item.link) do |f|
    t=f.read
    u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*mp4video[\(\)\_A-Za-z0-9\/-]*\.m4v/).first
    u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*m4v[\(\)\_A-Za-z0-9\/-]*\.m4v/).first unless u
    puts 'curl "'+u+'" >"' + u.scan(/MCM_[\_A-Za-z0-9\(\)\/-]*\.m4v/).first + '"'
  end
end

Revision: 38152
at December 27, 2010 12:20 by hafthor


Updated Code
require 'rss'
require 'open-uri'
rss=nil
open('http://www.microsoft.com/feeds/TechNet/en-us/How-to-videos/SQL_Server_2008_Microsoft_Certified_Master_(MCM)_Readiness_Videos.xml') do |f|
  rss = RSS::Parser.parse(f.read, false)
end
rss.items.each do |item|
  open(item.link) do |f|
    t=f.read
    u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*mp4video[\(\)\_A-Za-z0-9\/-]*\.m4v/).first
    u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*m4v[\(\)\_A-Za-z0-9\/-]*\.m4v/).first unless u
    puts 'curl "'+u+'" >' + u.scan(/MCM_[\_A-Za-z0-9\(\)\/-]*\.m4v/).first
  end
end

Revision: 38151
at December 27, 2010 11:54 by hafthor


Initial Code
require 'rss'
require 'open-uri'
rss=nil
open('http://www.microsoft.com/feeds/TechNet/en-us/How-to-videos/SQL_Server_2008_Microsoft_Certified_Master_(MCM)_Readiness_Videos.xml') do |f|
  rss = RSS::Parser.parse(f.read, false)
end
i=0
rss.items.each do |item|
  #puts item.link
  open(item.link) do |f|
    t=f.read
    u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*mp4video[\(\)\_A-Za-z0-9\/-]*\.m4v/).first
    u=t.scan(/http\:\/\/download.microsoft.com\/[\_A-Za-z0-9\/-]*m4v[\(\)\_A-Za-z0-9\/-]*\.m4v/).first unless u
    i=i+1
    #puts u
    puts 'curl "'+u+'" >' + u.scan(/MCM_[\_A-Za-z0-9\(\)\/-]*\.m4v/).first
  end
end

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

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

Initial Title
Create CURL batch to download all Microsoft SQL MCM prep videos

Initial Tags
ruby

Initial Language
Ruby