Properly detect YouTube error messages to print them on screen (fixes issue #172)
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 25 Jul 2010 09:55:49 +0000 (11:55 +0200)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:28:36 +0000 (11:28 +0100)
youtube-dl

index 48c13b701cce6d13382eae08e84b25cf60396600..8cfa6dfd622d81e8ac0453af7fe2b63c82810bb7 100755 (executable)
@@ -844,6 +844,14 @@ class YoutubeIE(InfoExtractor):
                        except (urllib2.URLError, httplib.HTTPException, socket.error), err:
                                self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % str(err))
                                return
+               if 'token' not in video_info:
+                       if 'reason' in video_info:
+                               self._downloader.trouble(u'ERROR: YouTube said: %s' % video_info['reason'][0])
+                       else:
+                               self._downloader.trouble(u'ERROR: "token" parameter not in video info for unknown reason')
+                       return
+
+               # Start extracting information
                self.report_information_extraction(video_id)
 
                # uploader