diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-01-07 09:51:57 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-01-07 09:52:00 +0100 |
commit | 0eecc6a417a111f442d153404bf47e781d5b53af (patch) | |
tree | ec8c784d5a3193136c3f087fe2483c436e19ae8e /youtube_dl/extractor | |
parent | 0dc13f4c4a440519f85c79a94f6ba7587ed3a2fc (diff) |
[vimeo] Add support for passwords for player. URLs
Fixes #2053
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/vimeo.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index 81c495d1e..540ca4fcc 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -124,6 +124,19 @@ class VimeoIE(InfoExtractor): 'Verifying the password', 'Wrong password') + def _verify_player_video_password(self, url, video_id): + password = self._downloader.params.get('videopassword', None) + if password is None: + raise ExtractorError('This video is protected by a password, use the --video-password option') + data = compat_urllib_parse.urlencode({'password': password}) + pass_url = url + '/check-password' + password_request = compat_urllib_request.Request(pass_url, data) + password_request.add_header('Content-Type', 'application/x-www-form-urlencoded') + return self._download_json( + password_request, video_id, + 'Verifying the password', + 'Wrong password') + def _real_initialize(self): self._login() @@ -184,8 +197,7 @@ class VimeoIE(InfoExtractor): cause=e) else: if config.get('view') == 4: - self._verify_video_password(url, video_id, webpage) - return self._real_extract(url) + config = self._verify_player_video_password(url, video_id) # Extract title video_title = config["video"]["title"] |