Skip to content

Instantly share code, notes, and snippets.

@yas375
Last active December 18, 2015 11:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yas375/5773583 to your computer and use it in GitHub Desktop.
Save yas375/5773583 to your computer and use it in GitHub Desktop.

In continuation of discussion started here there is a script, which allows to download videos. It will download and store them in the same directory as script is. If file is already exist - it would be downloaded again. As a result: you can run a few instances of script and they will download and store a few videos in parallel.

To get it all working you need the url with all the sessions links. I've grubbed it from the iOS app using mitmproxy:

  1. run mitmproxy on your computer which is in the same network with your ios device.
  2. on your ios device in wifi preferences set to use your computer as proxy (you need to provide your computer's ip address in local network, and port. 8080 is a default port for mitmproxy)
  3. run the app on ios app
  4. grub the url to .../videos.json and put in the script.

Put the downloader.rb to directory where you want to store the videos and run ruby downloader.rb.

When new videos become available - rerun the script and it will download new videos ;)

Good luck! :)

require "rubygems"
require 'open-uri'
require "json"
# Put the correct url. See instructions at https://gist.github.com/yas375/5773583
web_contents = open('https://XXXXXXXXXX/videos.json') { |f| f.read }
json = JSON.parse(web_contents)
# we need only 2013
sessions = json['sessions'].select { |session| session['year'] == 2013 }
sessions.each do |session|
filename = "#{session['id']} - #{session['title']}.mp4"
puts "=" * 30
if File.exist? filename
puts "\n#{filename} exists. Skipping.\n\n"
else
puts "\n Starting downloading: #{filename}\n\n"
url = session['url']
# replace ref.mov in url
url['ref.mov'] = "atv.m3u8" # 720p. Also valid are: ipad_w.m3u8 and iphone_c.m3u8
command = "ffmpeg -y -i #{url} \"#{filename}\""
system(command)
end
end
@timarnold
Copy link

I'm not seeing the videos.json URL in mitmproxy, just the m3u8, ts, and mov files for individual movies.

@tonyarnold
Copy link

This doesn't seem to work anymore. Hopefully Apple recognise quite a few of us have very long flights home in a few days…

@yas375
Copy link
Author

yas375 commented Jun 14, 2013

@timarnold I've found the link exactly via mitmproxy. When you open the all is asks the server for list of all videos (it includes videos from other years as well).

But anyway, looks like they have added links to download directly from theirs site:

aa

:)

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