Skip to content

Instantly share code, notes, and snippets.

@delebedev
Last active August 29, 2015 14:22
Show Gist options
  • Save delebedev/8823bf1dc09274fb06a8 to your computer and use it in GitHub Desktop.
Save delebedev/8823bf1dc09274fb06a8 to your computer and use it in GitHub Desktop.
Get all fresh WWDC sessions at once
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'ostruct'
require 'fileutils'
PATH = "https://devimages.apple.com.edgekey.net/wwdc-services/ftzj8e4h/6rsxhod7fvdtnjnmgsun/videos.json"
WWDC_DIR = "#{Dir.home}/Downloads/wwdc"
FileUtils.mkdir_p(WWDC_DIR) unless File.exists?(WWDC_DIR)
uri = URI(PATH)
json = Net::HTTP.get(uri)
sessions = JSON.parse(json)['sessions'].map { |x| OpenStruct.new(x) }
sessions.select {|x| x.year == 2015 }.each do |x|
sessionURL = x.download_sd
file = sessionURL.split('/').last
next if Dir.entries(WWDC_DIR).include?(file)
command = Thread.new do
puts "Downloading session: #{x.title}"
`curl #{sessionURL} --output #{WWDC_DIR}/#{file}`
end
command.join
end
@wanderwaltz
Copy link

A handy script, thanks for this one. Would be nice to know the total download size beforehand though. Just to be sure there's enough space to get them all.

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