mirror of
https://gitlab.com/dstftw/youtube-dl.git
synced 2020-11-16 09:42:26 +00:00
[youtube] Fix authentication (#10392)
This commit is contained in:
parent
ccb6570e9e
commit
1212e9972f
|
@ -91,36 +91,17 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||||
if login_page is False:
|
if login_page is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
galx = self._search_regex(r'(?s)<input.+?name="GALX".+?value="(.+?)"',
|
login_form = self._hidden_inputs(login_page)
|
||||||
login_page, 'Login GALX parameter')
|
|
||||||
|
|
||||||
# Log in
|
login_form.update({
|
||||||
login_form_strs = {
|
|
||||||
'continue': 'https://www.youtube.com/signin?action_handle_signin=true&feature=sign_in_button&hl=en_US&nomobiletemp=1',
|
|
||||||
'Email': username,
|
'Email': username,
|
||||||
'GALX': galx,
|
|
||||||
'Passwd': password,
|
'Passwd': password,
|
||||||
|
})
|
||||||
'PersistentCookie': 'yes',
|
|
||||||
'_utf8': '霱',
|
|
||||||
'bgresponse': 'js_disabled',
|
|
||||||
'checkConnection': '',
|
|
||||||
'checkedDomains': 'youtube',
|
|
||||||
'dnConn': '',
|
|
||||||
'pstMsg': '0',
|
|
||||||
'rmShown': '1',
|
|
||||||
'secTok': '',
|
|
||||||
'signIn': 'Sign in',
|
|
||||||
'timeStmp': '',
|
|
||||||
'service': 'youtube',
|
|
||||||
'uilel': '3',
|
|
||||||
'hl': 'en_US',
|
|
||||||
}
|
|
||||||
|
|
||||||
login_results = self._download_webpage(
|
login_results = self._download_webpage(
|
||||||
self._PASSWORD_CHALLENGE_URL, 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))
|
data=urlencode_postdata(login_form))
|
||||||
if login_results is False:
|
if login_results is False:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue