aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-12-03 20:16:52 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-12-03 20:16:52 +0100
commitd494389821de832874dc78abc2fe16365b5fe815 (patch)
tree110d74e820bbfe8f8acb4eea6e789605c8adfe57 /youtube_dl/YoutubeDL.py
parent1dcc4c0cad886457c0fa5f874c38f95f0510ea4f (diff)
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.
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 80c056dc8..77339dddf 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -816,7 +816,16 @@ class YoutubeDL(object):
with open(info_filename, 'r') as f:
# TODO: Check for errors
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):
"""Run all the postprocessors on the given file."""