aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/noco.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-02-24 21:50:13 +0700
committerSergey M․ <dstftw@gmail.com>2017-02-24 21:51:56 +0700
commitad3033037ce6b6809c3d06f2074d36691ba10cbe (patch)
treed436633d592e69d14b4403f4e7e87f6853ede942 /youtube_dl/extractor/noco.py
parentf3bc281239bafa971195eefd30773d152bfdb10c (diff)
[noco] Modernize
Diffstat (limited to 'youtube_dl/extractor/noco.py')
-rw-r--r--youtube_dl/extractor/noco.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/youtube_dl/extractor/noco.py b/youtube_dl/extractor/noco.py
index fc0624dd0..8b83e1f76 100644
--- a/youtube_dl/extractor/noco.py
+++ b/youtube_dl/extractor/noco.py
@@ -69,16 +69,17 @@ class NocoIE(InfoExtractor):
if username is None:
return
- login_form = {
- 'a': 'login',
- 'cookie': '1',
- 'username': username,
- 'password': password,
- }
- request = sanitized_Request(self._LOGIN_URL, urlencode_postdata(login_form))
- request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
-
- login = self._download_json(request, None, 'Logging in as %s' % username)
+ login = self._download_json(
+ self._LOGIN_URL, None, 'Logging in as %s' % username,
+ data=urlencode_postdata({
+ 'a': 'login',
+ 'cookie': '1',
+ 'username': username,
+ 'password': password,
+ }),
+ headers={
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
+ })
if 'erreur' in login:
raise ExtractorError('Unable to login: %s' % clean_html(login['erreur']), expected=True)