Skip to content

Instantly share code, notes, and snippets.

@sikachu
Created June 11, 2012 20:47
Show Gist options
  • Save sikachu/2912582 to your computer and use it in GitHub Desktop.
Save sikachu/2912582 to your computer and use it in GitHub Desktop.
Download "WWDC 2012" from apple. http://events.apple.com.edgesuite.net/126pihbedvcoihbefvbhjkbvsefbg/event/index.html This script is based on previous Apple Special Event download script: https://gist.github.com/1997591
#!/usr/bin/env ruby
require 'open-uri'
size_hash = {"720p" => "6540", "720i" => "4540", "540p" => "2540", "540i" => "1840", "360p" => "1240", "360i" => "0640", "360is" => "0440", "224p" => "0240"}
if ["--help", "help", "-h"].include?(ARGV[0]) || ARGV.size < 1
puts "Usage: #{File.basename __FILE__} ( #{size_hash.keys.join(' | ')} )"
exit 0
end
video_size = size_hash[ARGV[0]]
outfilename = "wwdc_2012.ts"
File.unlink outfilename if File.exists? outfilename
if video_size
baseurl = "http://qthttp.apple.com.edgesuite.net/126pihbedvcoihbefvbhjkbvsefbg/"
outfile = open outfilename, 'w+'
puts baseurl + video_size + "_vod.m3u8"
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}..."
begin
infile = open baseurl + "/" + line.strip
rescue StandardError => ex
puts "retry..."
retry
raise
end
outfile.write infile.read
infile.close
puts "Done"
end
outfile.close
else
puts "Wrong option."
exit 1
end
@sikachu
Copy link
Author

sikachu commented Jun 11, 2012

Usage:

curl -L -O https://gist.github.com/raw/2912582/410b41da4f8ab2837c88c8dec39db24c69edc416/down_wwdc_2012.rb
ruby down_wwdc_2012.rb ( 720p | 720i | 540p | 540i | 360p | 360i | 360is | 224p )

(You'll need Ruby for this to work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment