aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-09 04:55:02 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-09 04:55:02 +0100
commitdb4da140273d119e6f75445ee6f8cc286523b63e (patch)
tree59e240a87e72b035071d74f8816845685b85ca00 /youtube_dl/YoutubeDL.py
parent2101830c0d27e6d9ad2f564ff004565e71da1ec5 (diff)
parentd494389821de832874dc78abc2fe16365b5fe815 (diff)
downloadyoutube-dl-db4da140273d119e6f75445ee6f8cc286523b63e.tar.xz
Merge remote-tracking branch 'jaimeMF/load-info'
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 17b3827f2..79d5c7e5e 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -882,6 +882,21 @@ class YoutubeDL(object):
return self._download_retcode
+ def download_with_info_file(self, info_filename):
+ with open(info_filename, 'r') as f:
+ # TODO: Check for errors
+ info = json.load(f)
+ try:
+ self.process_ie_result(info, download=True)
+ except DownloadError:
+ webpage_url = info.get('webpage_url')
+ if webpage_url is not None:
+ self.report_warning(u'The info failed to download, trying with "%s"' % webpage_url)
+ return self.download([webpage_url])
+ else:
+ raise
+ return self._download_retcode
+
def post_process(self, filename, ie_info):
"""Run all the postprocessors on the given file."""
info = dict(ie_info)