]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[vimeo] Fix logging in python 3.x
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 24 Apr 2014 12:44:27 +0000 (14:44 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 24 Apr 2014 12:44:27 +0000 (14:44 +0200)
The POST data must be a bytes object.

youtube_dl/extractor/vimeo.py

index bb08c61509e6d68a8661c3d4876cb258e99fa832..8befb4a4f2a32bec33eb6ff2a97e4f0de896bb66 100644 (file)
@@ -17,6 +17,7 @@ from ..utils import (
     RegexNotFoundError,
     std_headers,
     unsmuggle_url,
+    urlencode_postdata,
 )
 
 
@@ -119,12 +120,13 @@ class VimeoIE(SubtitlesInfoExtractor):
         login_url = 'https://vimeo.com/log_in'
         webpage = self._download_webpage(login_url, None, False)
         token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
-        data = compat_urllib_parse.urlencode({'email': username,
-                                              'password': password,
-                                              'action': 'login',
-                                              'service': 'vimeo',
-                                              'token': token,
-                                              })
+        data = urlencode_postdata({
+            'email': username,
+            'password': password,
+            'action': 'login',
+            'service': 'vimeo',
+            'token': token,
+        })
         login_request = compat_urllib_request.Request(login_url, data)
         login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         login_request.add_header('Cookie', 'xsrft=%s' % token)