mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
Option '--load-info': if the download fails, try extracting the info with the 'webpage_url' field of the info dict
The video url may have expired.
This commit is contained in:
parent
1dcc4c0cad
commit
d494389821
1 changed files with 10 additions and 1 deletions
|
@ -816,7 +816,16 @@ def download_with_info_file(self, info_filename):
|
||||||
with open(info_filename, 'r') as f:
|
with open(info_filename, 'r') as f:
|
||||||
# TODO: Check for errors
|
# TODO: Check for errors
|
||||||
info = json.load(f)
|
info = json.load(f)
|
||||||
self.process_ie_result(info, download=True)
|
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):
|
def post_process(self, filename, ie_info):
|
||||||
"""Run all the postprocessors on the given file."""
|
"""Run all the postprocessors on the given file."""
|
||||||
|
|
Loading…
Reference in a new issue