Skip to content

A feature-rich command-line audio/video downloader

Fix very wrong code for setting the language

Ricardo Garciacc109403853b
diff --git a/youtube-dl b/youtube-dl
index 323897a9c3..4ddf622749 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -493,12 +493,8 @@ class YoutubeIE(InfoExtractor):
self.to_stderr(u'WARNING: parsing .netrc: %s' % str(err))
return
- # No authentication to be performed
- if username is None:
- return
-
# Set language
- request = urllib2.Request(self._LOGIN_URL, None, std_headers)
+ request = urllib2.Request(self._LANG_URL, None, std_headers)
try:
self.report_lang()
urllib2.urlopen(request).read()
@@ -506,6 +502,10 @@ class YoutubeIE(InfoExtractor):
self.to_stderr(u'WARNING: unable to set language: %s' % str(err))
return
+ # No authentication to be performed
+ if username is None:
+ return
+
# Log in
login_form = {
'current_form': 'loginForm',