aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-08-24 00:25:21 +0700
committerSergey M․ <dstftw@gmail.com>2016-08-24 00:25:21 +0700
commit1212e9972fce69df6bd871a5c301294427299cbb (patch)
treec3dbdee72f9fd04bd732e9aab3fd64f011285a96
parentccb6570e9e625ff5e9adf88729e745acadcaff0e (diff)
downloadyoutube-dl-1212e9972fce69df6bd871a5c301294427299cbb.tar.xz
[youtube] Fix authentication (#10392)
-rw-r--r--youtube_dl/extractor/youtube.py27
1 files changed, 4 insertions, 23 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 268080ba6..38556d86e 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -91,36 +91,17 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
if login_page is False:
return
- galx = self._search_regex(r'(?s)<input.+?name="GALX".+?value="(.+?)"',
- login_page, 'Login GALX parameter')
+ login_form = self._hidden_inputs(login_page)
- # Log in
- login_form_strs = {
- 'continue': 'https://www.youtube.com/signin?action_handle_signin=true&feature=sign_in_button&hl=en_US&nomobiletemp=1',
+ login_form.update({
'Email': username,
- 'GALX': galx,
'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(
self._PASSWORD_CHALLENGE_URL, None,
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:
return False