[vimeo] Append cookies instead of overriding

This commit is contained in:
Sergey M․ 2015-11-11 22:23:23 +06:00
parent a4c2ab35c1
commit 9a8a12b7d8

View file

@ -49,8 +49,8 @@ def _login(self):
})) }))
login_request = compat_urllib_request.Request(self._LOGIN_URL, data) login_request = compat_urllib_request.Request(self._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', 'vuid=%s' % vuid)
login_request.add_header('Referer', self._LOGIN_URL) login_request.add_header('Referer', self._LOGIN_URL)
self._set_cookie('vimeo.com', 'vuid', vuid)
self._download_webpage(login_request, None, False, 'Wrong login info') self._download_webpage(login_request, None, False, 'Wrong login info')
def _extract_xsrft_and_vuid(self, webpage): def _extract_xsrft_and_vuid(self, webpage):
@ -217,8 +217,8 @@ def _verify_video_password(self, url, video_id, webpage):
url = url.replace('http://', 'https://') url = url.replace('http://', 'https://')
password_request = compat_urllib_request.Request(url + '/password', data) password_request = compat_urllib_request.Request(url + '/password', data)
password_request.add_header('Content-Type', 'application/x-www-form-urlencoded') password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
password_request.add_header('Cookie', 'clip_test_v2=0; vuid=%s' % vuid)
password_request.add_header('Referer', url) password_request.add_header('Referer', url)
self._set_cookie('vimeo.com', 'vuid', vuid)
return self._download_webpage( return self._download_webpage(
password_request, video_id, password_request, video_id,
'Verifying the password', 'Wrong password') 'Verifying the password', 'Wrong password')
@ -494,7 +494,7 @@ def _login_list_password(self, page_url, list_id, webpage):
password_url = compat_urlparse.urljoin(page_url, password_path) password_url = compat_urlparse.urljoin(page_url, password_path)
password_request = compat_urllib_request.Request(password_url, post) password_request = compat_urllib_request.Request(password_url, post)
password_request.add_header('Content-type', 'application/x-www-form-urlencoded') password_request.add_header('Content-type', 'application/x-www-form-urlencoded')
password_request.add_header('Cookie', 'vuid=%s' % vuid) self._set_cookie('vimeo.com', 'vuid', vuid)
self._set_cookie('vimeo.com', 'xsrft', token) self._set_cookie('vimeo.com', 'xsrft', token)
return self._download_webpage( return self._download_webpage(