Skip to content

Instantly share code, notes, and snippets.

@miettal
Last active February 28, 2018 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miettal/0df3e33a617d0cf10d0baa2140794220 to your computer and use it in GitHub Desktop.
Save miettal/0df3e33a617d0cf10d0baa2140794220 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# coding:utf-8
from pprint import pprint as pp
import requests
import json
url = "http://airbornemedia.gogoinflight.com/asp/api/media/ja-JP/collections/browse"
movie_url = "http://airbornemedia.gogoinflight.com/asp/api/media/ja-JP/{:s}"
f = open('download.sh', 'w')
r = requests.get(url);
obj1 = json.loads(r.text)
for collectionRefList in obj1['collectionRefList'] :
for merchandisedOrder in collectionRefList['merchandisedOrder'] :
r = requests.get(movie_url.format(merchandisedOrder))
obj2 = json.loads(r.text)
main_title = obj2['title']
for video in obj2['videos'] :
sub_title = video['subTitleLanguages']
src = video['src']
if sub_title is None :
filename = "{:s}.mp4".format(main_title.encode('utf-8'))
else :
filename = "{:s}-{:s}.mp4".format(main_title.encode('utf-8'), sub_title.encode('utf-8'))
f.write('curl {:s} > "{:s}"\n'.format(src, filename))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment