aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/common.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/common.py
parent98784ef8d6982a9e9dbc8893fe1206c67c371d43 (diff)
downloadhypervideo-pre-9d5d4d64f8d2e7dc3d45e37ac3a34a79ac29be57.tar.lz
hypervideo-pre-9d5d4d64f8d2e7dc3d45e37ac3a34a79ac29be57.tar.xz
hypervideo-pre-9d5d4d64f8d2e7dc3d45e37ac3a34a79ac29be57.zip
[youtube] Better message when login required
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 3b2bda0e7..ac2f59462 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -422,6 +422,14 @@ class InfoExtractor(object):
_GEO_IP_BLOCKS = None
_WORKING = True
+ _LOGIN_HINTS = {
+ 'any': 'Use --cookies, --username and --password or --netrc to provide account credentials',
+ 'cookies': (
+ 'Use --cookies for the authentication. '
+ 'See https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl for how to pass cookies'),
+ 'password': 'Use --username and --password or --netrc to provide account credentials',
+ }
+
def __init__(self, downloader=None):
"""Constructor. Receives an optional downloader."""
self._ready = False
@@ -978,12 +986,11 @@ class InfoExtractor(object):
self.to_screen('Logging in')
def raise_login_required(
- self, msg='This video is only available for registered users', metadata_available=False):
+ self, msg='This video is only available for registered users',
+ metadata_available=False, method='any'):
if metadata_available and self.get_param('ignore_no_formats_error'):
self.report_warning(msg)
- raise ExtractorError(
- '%s. Use --cookies, --username and --password or --netrc to provide account credentials' % msg,
- expected=True)
+ raise ExtractorError('%s. %s' % (msg, self._LOGIN_HINTS[method]), expected=True)
def raise_geo_restricted(
self, msg='This video is not available from your location due to geo restriction',