1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 08:26:50 +00:00

[twitch] Fix login

This commit is contained in:
Sergey M․ 2015-03-20 21:45:09 +06:00
parent cd32c2caba
commit 1887ecd4d6

View File

@ -23,6 +23,7 @@ class TwitchBaseIE(InfoExtractor):
_API_BASE = 'https://api.twitch.tv' _API_BASE = 'https://api.twitch.tv'
_USHER_BASE = 'http://usher.twitch.tv' _USHER_BASE = 'http://usher.twitch.tv'
_LOGIN_URL = 'https://secure.twitch.tv/user/login' _LOGIN_URL = 'https://secure.twitch.tv/user/login'
_LOGIN_POST_URL = 'https://secure-login.twitch.tv/login'
_NETRC_MACHINE = 'twitch' _NETRC_MACHINE = 'twitch'
def _handle_error(self, response): def _handle_error(self, response):
@ -67,14 +68,14 @@ class TwitchBaseIE(InfoExtractor):
'authenticity_token': authenticity_token, 'authenticity_token': authenticity_token,
'redirect_on_login': '', 'redirect_on_login': '',
'embed_form': 'false', 'embed_form': 'false',
'mp_source_action': '', 'mp_source_action': 'login-button',
'follow': '', 'follow': '',
'user[login]': username, 'login': username,
'user[password]': password, 'password': password,
} }
request = compat_urllib_request.Request( request = compat_urllib_request.Request(
self._LOGIN_URL, compat_urllib_parse.urlencode(login_form).encode('utf-8')) self._LOGIN_POST_URL, compat_urllib_parse.urlencode(login_form).encode('utf-8'))
request.add_header('Referer', self._LOGIN_URL) request.add_header('Referer', self._LOGIN_URL)
response = self._download_webpage( response = self._download_webpage(
request, None, 'Logging in as %s' % username) request, None, 'Logging in as %s' % username)