1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-01 03:22:52 -05:00

Merge remote-tracking branch 'jaimeMF/load-info'

This commit is contained in:
Philipp Hagemeister
2013-12-09 04:55:02 +01:00
2 changed files with 23 additions and 2 deletions

View File

@ -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)