Skip to content

A feature-rich command-line audio/video downloader

Properly detect YouTube error messages to print them on screen (fixes issue #172)

Ricardo Garciaf95f29fd25b2
diff --git a/youtube-dl b/youtube-dl
index 48c13b701c..8cfa6dfd62 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -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