mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-14 14:28:00 +09:00
[youtube] Fix authentication (Closes #10140)
This commit is contained in:
parent
fd8c8c7dcd
commit
e298d3a08c
@ -53,6 +53,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
"""Provide base functions for Youtube extractors"""
|
"""Provide base functions for Youtube extractors"""
|
||||||
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
||||||
_TWOFACTOR_URL = 'https://accounts.google.com/signin/challenge'
|
_TWOFACTOR_URL = 'https://accounts.google.com/signin/challenge'
|
||||||
|
_PASSWORD_CHALLENGE_URL = 'https://accounts.google.com/signin/challenge/sl/password'
|
||||||
_NETRC_MACHINE = 'youtube'
|
_NETRC_MACHINE = 'youtube'
|
||||||
# If True it will raise an error if no login info is provided
|
# If True it will raise an error if no login info is provided
|
||||||
_LOGIN_REQUIRED = False
|
_LOGIN_REQUIRED = False
|
||||||
@ -116,12 +117,10 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
'hl': 'en_US',
|
'hl': 'en_US',
|
||||||
}
|
}
|
||||||
|
|
||||||
login_data = urlencode_postdata(login_form_strs)
|
|
||||||
|
|
||||||
req = sanitized_Request(self._LOGIN_URL, login_data)
|
|
||||||
login_results = self._download_webpage(
|
login_results = self._download_webpage(
|
||||||
req, None,
|
self._PASSWORD_CHALLENGE_URL, None,
|
||||||
note='Logging in', errnote='unable to log in', fatal=False)
|
note='Logging in', errnote='unable to log in', fatal=False,
|
||||||
|
data=urlencode_postdata(login_form_strs))
|
||||||
if login_results is False:
|
if login_results is False:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user