[noco] Modernize

This commit is contained in:
Sergey M․ 2017-02-24 21:50:13 +07:00
parent f3bc281239
commit ad3033037c
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D
1 changed files with 11 additions and 10 deletions

View File

@ -69,16 +69,17 @@ class NocoIE(InfoExtractor):
if username is None: if username is None:
return return
login_form = { login = self._download_json(
self._LOGIN_URL, None, 'Logging in as %s' % username,
data=urlencode_postdata({
'a': 'login', 'a': 'login',
'cookie': '1', 'cookie': '1',
'username': username, 'username': username,
'password': password, 'password': password,
} }),
request = sanitized_Request(self._LOGIN_URL, urlencode_postdata(login_form)) headers={
request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
})
login = self._download_json(request, None, 'Logging in as %s' % username)
if 'erreur' in login: if 'erreur' in login:
raise ExtractorError('Unable to login: %s' % clean_html(login['erreur']), expected=True) raise ExtractorError('Unable to login: %s' % clean_html(login['erreur']), expected=True)