Last active
February 28, 2018 14:24
-
-
Save miettal/0df3e33a617d0cf10d0baa2140794220 to your computer and use it in GitHub Desktop.
This file contains 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 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