[vimeo] Fix authentication (Closes #7110)
authorSergey M․ <dstftw@gmail.com>
Fri, 9 Oct 2015 23:56:01 +0000 (05:56 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 9 Oct 2015 23:56:01 +0000 (05:56 +0600)
youtube_dl/extractor/vimeo.py

index 50df79ca12d7082c9615bba0fdc979a5f7ed6578..7dd52627dab8e47a84f6793abb44cec5b885e2da 100644 (file)
@@ -40,6 +40,9 @@ class VimeoBaseInfoExtractor(InfoExtractor):
         self.report_login()
         webpage = self._download_webpage(self._LOGIN_URL, None, False)
         token = self._extract_xsrft(webpage)
+        vuid = self._search_regex(
+            r'["\']vuid["\']\s*:\s*(["\'])(?P<vuid>.+?)\1',
+            webpage, 'vuid', group='vuid')
         data = urlencode_postdata({
             'action': 'login',
             'email': username,
@@ -49,6 +52,7 @@ class VimeoBaseInfoExtractor(InfoExtractor):
         })
         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('Cookie', 'vuid=%s' % vuid)
         login_request.add_header('Referer', self._LOGIN_URL)
         self._download_webpage(login_request, None, False, 'Wrong login info')