Option '--load-info': if the download fails, try extracting the info with the 'webpag...
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Tue, 3 Dec 2013 19:16:52 +0000 (20:16 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Tue, 3 Dec 2013 19:16:52 +0000 (20:16 +0100)
The video url may have expired.

youtube_dl/YoutubeDL.py

index 80c056dc8215d7178a6dae023df5e2271add41ce..77339dddfd591f2a02bdba3e91414142ec9c1d7c 100644 (file)
@@ -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."""