X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fvimeo.py;h=e7284049df7740b66d8e9462436de4593973bd87;hb=785521bf4fbd99b2916bdab5d847d84424196c1d;hp=06b0bed41e68401a8667cbabdca0d9796ea8ca3d;hpb=121c09c7be1ac2944f3432122104c1952bfd1f04;p=youtube-dl diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index 06b0bed41..e7284049d 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -18,6 +18,7 @@ from ..utils import ( InAdvancePagedList, int_or_none, RegexNotFoundError, + smuggle_url, std_headers, unsmuggle_url, urlencode_postdata, @@ -188,9 +189,9 @@ class VimeoIE(VimeoBaseInfoExtractor, SubtitlesInfoExtractor): password_request = compat_urllib_request.Request(pass_url + '/password', data) password_request.add_header('Content-Type', 'application/x-www-form-urlencoded') password_request.add_header('Cookie', 'xsrft=%s' % token) - self._download_webpage(password_request, video_id, - 'Verifying the password', - 'Wrong password') + return self._download_webpage( + password_request, video_id, + 'Verifying the password', 'Wrong password') def _verify_player_video_password(self, url, video_id): password = self._downloader.params.get('videopassword', None) @@ -266,9 +267,12 @@ class VimeoIE(VimeoBaseInfoExtractor, SubtitlesInfoExtractor): if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage): raise ExtractorError('The author has restricted the access to this video, try with the "--referer" option') - if re.search(']+?id="pw_form"', webpage) is not None: + if re.search(r']+?id="pw_form"', webpage) is not None: + if data and '_video_password_verified' in data: + raise ExtractorError('video password verification failed!') self._verify_video_password(url, video_id, webpage) - return self._real_extract(url) + return self._real_extract( + smuggle_url(url, {'_video_password_verified': 'verified'})) else: raise ExtractorError('Unable to extract info section', cause=e) @@ -401,6 +405,7 @@ class VimeoChannelIE(InfoExtractor): _TESTS = [{ 'url': 'http://vimeo.com/channels/tributes', 'info_dict': { + 'id': 'tributes', 'title': 'Vimeo Tributes', }, 'playlist_mincount': 25, @@ -412,12 +417,47 @@ class VimeoChannelIE(InfoExtractor): def _extract_list_title(self, webpage): return self._html_search_regex(self._TITLE_RE, webpage, 'list title') + def _login_list_password(self, page_url, list_id, webpage): + login_form = self._search_regex( + r'(?s)]+?id="pw_form"(.*?)', + webpage, 'login form', default=None) + if not login_form: + return webpage + + password = self._downloader.params.get('videopassword', None) + if password is None: + raise ExtractorError('This album is protected by a password, use the --video-password option', expected=True) + fields = dict(re.findall(r'''(?x)[^/]+)' _TESTS = [{ 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d', - 'file': '75524534.mp4', 'md5': 'c507a72f780cacc12b2248bb4006d253', 'info_dict': { + 'id': '75524534', + 'ext': 'mp4', 'title': "DICK HARDWICK 'Comedian'", 'uploader': 'Richard Hardwick', } @@ -562,6 +616,7 @@ class VimeoLikesIE(InfoExtractor): 'url': 'https://vimeo.com/user755559/likes/', 'playlist_mincount': 293, "info_dict": { + 'id': 'user755559_likes', "description": "See all the videos urza likes", "title": 'Videos urza likes', },