[vimeo] Fix password protected videos (Closes #5001)
authorSergey M․ <dstftw@gmail.com>
Sat, 21 Feb 2015 12:00:25 +0000 (18:00 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 21 Feb 2015 12:00:25 +0000 (18:00 +0600)
youtube_dl/extractor/vimeo.py

index 78d287e0e66d5d0972c3d48edb890673413085ea..5f8649e35573f823c0524b7dbd6c2783d09f40e2 100644 (file)
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
 import json
 import re
 import itertools
+import hashlib
 
 from .common import InfoExtractor
 from .subtitles import SubtitlesInfoExtractor
@@ -225,6 +226,10 @@ class VimeoIE(VimeoBaseInfoExtractor, SubtitlesInfoExtractor):
         if mobj.group('pro') or mobj.group('player'):
             url = 'http://player.vimeo.com/video/' + video_id
 
+        password = self._downloader.params.get('videopassword', None)
+        if password:
+            headers['Cookie'] = '%s_password=%s' % (video_id, hashlib.md5(password).hexdigest())
+
         # Retrieve video webpage to extract further information
         request = compat_urllib_request.Request(url, None, headers)
         try: