Created
June 7, 2011 15:02
-
-
Save venj/1012426 to your computer and use it in GitHub Desktop.
Download WWDC '11 Keynote to your hard disk
This file contains hidden or 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 | |
require 'open-uri' | |
if ["--help", "help", "-h"].include?(ARGV[0]) || ARGV.size < 1 | |
puts "Usage: #{File.basename __FILE__} ( 720p | 540p | 540i | 360p | 360i | 360is | 224p )" | |
exit 0 | |
end | |
size_hash = {"720p" => "4540", "540p" => "2540", "540i" => "1840", "360p" => "1240", "360i" => "0640", "360is" => "0440", "224p" => "0240"} | |
video_size = size_hash[ARGV[0]] | |
outfilename = "wwdc11.ts" | |
File.unlink outfilename if File.exists? outfilename | |
if video_size | |
baseurl = "http://qthttp.apple.com.edgesuite.net/11piubpwiqubf06/" | |
outfile = open outfilename, 'w+' | |
listfile = open baseurl + video_size + "_vod.m3u8" | |
listfile.each_line do |line| | |
next if line =~ /^#/ | |
file = line.strip.split("/").last | |
print "Downloading fragment file: #{file}..." | |
infile = open baseurl + line.strip | |
outfile.write infile.read | |
infile.close | |
puts "Done" | |
end | |
outfile.close | |
else | |
puts "Wrong option." | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment