[vimeo] Fix logging in python 3.x

The POST data must be a bytes object.
pull/8/head
Jaime Marquínez Ferrándiz 11 years ago
parent 4b10aadffc
commit a980bc4324

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

Loading…
Cancel
Save