aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/extractor/youtube.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-05-19 19:11:44 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-05-20 15:55:55 +0530
commit9d5d4d64f8d2e7dc3d45e37ac3a34a79ac29be57 (patch)
tree0c95a085576109fc4f93127a07889fc4ad1a5b66 /yt_dlp/extractor/youtube.py
parent98784ef8d6982a9e9dbc8893fe1206c67c371d43 (diff)
[youtube] Better message when login required
Diffstat (limited to 'yt_dlp/extractor/youtube.py')
-rw-r--r--yt_dlp/extractor/youtube.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 5e836f883..3f021c281 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -85,7 +85,20 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
If _LOGIN_REQUIRED is set and no authentication was provided, an error is raised.
"""
+
+ def warn(message):
+ self.report_warning(message)
+
+ # username+password login is broken
+ if self._LOGIN_REQUIRED and self.get_param('cookiefile') is None:
+ self.raise_login_required(
+ 'Login details are needed to download this content', method='cookies')
username, password = self._get_login_info()
+ if username:
+ warn('Logging in using username and password is broken. %s' % self._LOGIN_HINTS['cookies'])
+ return
+ # Everything below this is broken!
+
# No authentication to be performed
if username is None:
if self._LOGIN_REQUIRED and self.get_param('cookiefile') is None:
@@ -126,9 +139,6 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
'Google-Accounts-XSRF': 1,
})
- def warn(message):
- self.report_warning(message)
-
lookup_req = [
username,
None, [], None, 'US', None, None, 2, False, True,
@@ -4018,9 +4028,6 @@ class YoutubeFeedsInfoExtractor(YoutubeTabIE):
def IE_NAME(self):
return 'youtube:%s' % self._FEED_NAME
- def _real_initialize(self):
- self._login()
-
def _real_extract(self, url):
return self.url_result(
'https://www.youtube.com/feed/%s' % self._FEED_NAME,