]>
Commit | Line | Data |
---|---|---|
1 | import base64 | |
2 | import functools | |
3 | import itertools | |
4 | import re | |
5 | import urllib.parse | |
6 | ||
7 | from .common import InfoExtractor | |
8 | from ..networking import HEADRequest, Request | |
9 | from ..networking.exceptions import HTTPError | |
10 | from ..utils import ( | |
11 | ExtractorError, | |
12 | OnDemandPagedList, | |
13 | clean_html, | |
14 | determine_ext, | |
15 | get_element_by_class, | |
16 | int_or_none, | |
17 | js_to_json, | |
18 | merge_dicts, | |
19 | parse_filesize, | |
20 | parse_iso8601, | |
21 | parse_qs, | |
22 | smuggle_url, | |
23 | str_or_none, | |
24 | traverse_obj, | |
25 | try_get, | |
26 | unified_timestamp, | |
27 | unsmuggle_url, | |
28 | urlencode_postdata, | |
29 | urlhandle_detect_ext, | |
30 | urljoin, | |
31 | ) | |
32 | ||
33 | ||
34 | class VimeoBaseInfoExtractor(InfoExtractor): | |
35 | _NETRC_MACHINE = 'vimeo' | |
36 | _LOGIN_REQUIRED = False | |
37 | _LOGIN_URL = 'https://vimeo.com/log_in' | |
38 | ||
39 | @staticmethod | |
40 | def _smuggle_referrer(url, referrer_url): | |
41 | return smuggle_url(url, {'referer': referrer_url}) | |
42 | ||
43 | def _unsmuggle_headers(self, url): | |
44 | """@returns (url, smuggled_data, headers)""" | |
45 | url, data = unsmuggle_url(url, {}) | |
46 | headers = self.get_param('http_headers').copy() | |
47 | if 'referer' in data: | |
48 | headers['Referer'] = data['referer'] | |
49 | return url, data, headers | |
50 | ||
51 | def _perform_login(self, username, password): | |
52 | viewer = self._download_json('https://vimeo.com/_next/viewer', None, 'Downloading login token') | |
53 | data = { | |
54 | 'action': 'login', | |
55 | 'email': username, | |
56 | 'password': password, | |
57 | 'service': 'vimeo', | |
58 | 'token': viewer['xsrft'], | |
59 | } | |
60 | self._set_vimeo_cookie('vuid', viewer['vuid']) | |
61 | try: | |
62 | self._download_webpage( | |
63 | self._LOGIN_URL, None, 'Logging in', | |
64 | data=urlencode_postdata(data), headers={ | |
65 | 'Content-Type': 'application/x-www-form-urlencoded', | |
66 | 'Referer': self._LOGIN_URL, | |
67 | }) | |
68 | except ExtractorError as e: | |
69 | if isinstance(e.cause, HTTPError) and e.cause.status == 418: | |
70 | raise ExtractorError( | |
71 | 'Unable to log in: bad username or password', | |
72 | expected=True) | |
73 | raise ExtractorError('Unable to log in') | |
74 | ||
75 | def _real_initialize(self): | |
76 | if self._LOGIN_REQUIRED and not self._get_cookies('https://vimeo.com').get('vuid'): | |
77 | self._raise_login_required() | |
78 | ||
79 | def _get_video_password(self): | |
80 | password = self.get_param('videopassword') | |
81 | if password is None: | |
82 | raise ExtractorError( | |
83 | 'This video is protected by a password, use the --video-password option', | |
84 | expected=True) | |
85 | return password | |
86 | ||
87 | def _verify_video_password(self, url, video_id, password, token, vuid): | |
88 | if url.startswith('http://'): | |
89 | # vimeo only supports https now, but the user can give an http url | |
90 | url = url.replace('http://', 'https://') | |
91 | self._set_vimeo_cookie('vuid', vuid) | |
92 | return self._download_webpage( | |
93 | url + '/password', video_id, 'Verifying the password', | |
94 | 'Wrong password', data=urlencode_postdata({ | |
95 | 'password': password, | |
96 | 'token': token, | |
97 | }), headers={ | |
98 | 'Content-Type': 'application/x-www-form-urlencoded', | |
99 | 'Referer': url, | |
100 | }) | |
101 | ||
102 | def _extract_xsrft_and_vuid(self, webpage): | |
103 | xsrft = self._search_regex( | |
104 | r'(?:(?P<q1>["\'])xsrft(?P=q1)\s*:|xsrft\s*[=:])\s*(?P<q>["\'])(?P<xsrft>.+?)(?P=q)', | |
105 | webpage, 'login token', group='xsrft') | |
106 | vuid = self._search_regex( | |
107 | r'["\']vuid["\']\s*:\s*(["\'])(?P<vuid>.+?)\1', | |
108 | webpage, 'vuid', group='vuid') | |
109 | return xsrft, vuid | |
110 | ||
111 | def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs): | |
112 | vimeo_config = self._search_regex( | |
113 | r'vimeo\.config\s*=\s*(?:({.+?})|_extend\([^,]+,\s+({.+?})\));', | |
114 | webpage, 'vimeo config', *args, **kwargs) | |
115 | if vimeo_config: | |
116 | return self._parse_json(vimeo_config, video_id) | |
117 | ||
118 | def _set_vimeo_cookie(self, name, value): | |
119 | self._set_cookie('vimeo.com', name, value) | |
120 | ||
121 | def _parse_config(self, config, video_id): | |
122 | video_data = config['video'] | |
123 | video_title = video_data.get('title') | |
124 | live_event = video_data.get('live_event') or {} | |
125 | live_status = { | |
126 | 'pending': 'is_upcoming', | |
127 | 'active': 'is_upcoming', | |
128 | 'started': 'is_live', | |
129 | 'ended': 'post_live', | |
130 | }.get(live_event.get('status')) | |
131 | is_live = live_status == 'is_live' | |
132 | request = config.get('request') or {} | |
133 | ||
134 | formats = [] | |
135 | subtitles = {} | |
136 | ||
137 | config_files = video_data.get('files') or request.get('files') or {} | |
138 | for f in (config_files.get('progressive') or []): | |
139 | video_url = f.get('url') | |
140 | if not video_url: | |
141 | continue | |
142 | formats.append({ | |
143 | 'url': video_url, | |
144 | 'format_id': 'http-{}'.format(f.get('quality')), | |
145 | 'source_preference': 10, | |
146 | 'width': int_or_none(f.get('width')), | |
147 | 'height': int_or_none(f.get('height')), | |
148 | 'fps': int_or_none(f.get('fps')), | |
149 | 'tbr': int_or_none(f.get('bitrate')), | |
150 | }) | |
151 | ||
152 | # TODO: fix handling of 308 status code returned for live archive manifest requests | |
153 | sep_pattern = r'/sep/video/' | |
154 | for files_type in ('hls', 'dash'): | |
155 | for cdn_name, cdn_data in (try_get(config_files, lambda x: x[files_type]['cdns']) or {}).items(): | |
156 | manifest_url = cdn_data.get('url') | |
157 | if not manifest_url: | |
158 | continue | |
159 | format_id = f'{files_type}-{cdn_name}' | |
160 | sep_manifest_urls = [] | |
161 | if re.search(sep_pattern, manifest_url): | |
162 | for suffix, repl in (('', 'video'), ('_sep', 'sep/video')): | |
163 | sep_manifest_urls.append((format_id + suffix, re.sub( | |
164 | sep_pattern, f'/{repl}/', manifest_url))) | |
165 | else: | |
166 | sep_manifest_urls = [(format_id, manifest_url)] | |
167 | for f_id, m_url in sep_manifest_urls: | |
168 | if files_type == 'hls': | |
169 | fmts, subs = self._extract_m3u8_formats_and_subtitles( | |
170 | m_url, video_id, 'mp4', live=is_live, m3u8_id=f_id, | |
171 | note=f'Downloading {cdn_name} m3u8 information', | |
172 | fatal=False) | |
173 | formats.extend(fmts) | |
174 | self._merge_subtitles(subs, target=subtitles) | |
175 | elif files_type == 'dash': | |
176 | if 'json=1' in m_url: | |
177 | real_m_url = (self._download_json(m_url, video_id, fatal=False) or {}).get('url') | |
178 | if real_m_url: | |
179 | m_url = real_m_url | |
180 | fmts, subs = self._extract_mpd_formats_and_subtitles( | |
181 | m_url.replace('/master.json', '/master.mpd'), video_id, f_id, | |
182 | f'Downloading {cdn_name} MPD information', | |
183 | fatal=False) | |
184 | formats.extend(fmts) | |
185 | self._merge_subtitles(subs, target=subtitles) | |
186 | ||
187 | live_archive = live_event.get('archive') or {} | |
188 | live_archive_source_url = live_archive.get('source_url') | |
189 | if live_archive_source_url and live_archive.get('status') == 'done': | |
190 | formats.append({ | |
191 | 'format_id': 'live-archive-source', | |
192 | 'url': live_archive_source_url, | |
193 | 'quality': 10, | |
194 | }) | |
195 | ||
196 | for tt in (request.get('text_tracks') or []): | |
197 | subtitles.setdefault(tt['lang'], []).append({ | |
198 | 'ext': 'vtt', | |
199 | 'url': urljoin('https://vimeo.com', tt['url']), | |
200 | }) | |
201 | ||
202 | thumbnails = [] | |
203 | if not is_live: | |
204 | for key, thumb in (video_data.get('thumbs') or {}).items(): | |
205 | thumbnails.append({ | |
206 | 'id': key, | |
207 | 'width': int_or_none(key), | |
208 | 'url': thumb, | |
209 | }) | |
210 | thumbnail = video_data.get('thumbnail') | |
211 | if thumbnail: | |
212 | thumbnails.append({ | |
213 | 'url': thumbnail, | |
214 | }) | |
215 | ||
216 | owner = video_data.get('owner') or {} | |
217 | video_uploader_url = owner.get('url') | |
218 | ||
219 | duration = int_or_none(video_data.get('duration')) | |
220 | chapter_data = try_get(config, lambda x: x['embed']['chapters']) or [] | |
221 | chapters = [{ | |
222 | 'title': current_chapter.get('title'), | |
223 | 'start_time': current_chapter.get('timecode'), | |
224 | 'end_time': next_chapter.get('timecode'), | |
225 | } for current_chapter, next_chapter in zip(chapter_data, chapter_data[1:] + [{'timecode': duration}])] | |
226 | if chapters and chapters[0]['start_time']: # Chapters may not start from 0 | |
227 | chapters[:0] = [{'title': '<Untitled>', 'start_time': 0, 'end_time': chapters[0]['start_time']}] | |
228 | ||
229 | return { | |
230 | 'id': str_or_none(video_data.get('id')) or video_id, | |
231 | 'title': video_title, | |
232 | 'uploader': owner.get('name'), | |
233 | 'uploader_id': video_uploader_url.split('/')[-1] if video_uploader_url else None, | |
234 | 'uploader_url': video_uploader_url, | |
235 | 'thumbnails': thumbnails, | |
236 | 'duration': duration, | |
237 | 'chapters': chapters or None, | |
238 | 'formats': formats, | |
239 | 'subtitles': subtitles, | |
240 | 'live_status': live_status, | |
241 | 'release_timestamp': traverse_obj(live_event, ('ingest', 'scheduled_start_time', {parse_iso8601})), | |
242 | # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps | |
243 | # at the same time without actual units specified. | |
244 | '_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'), | |
245 | } | |
246 | ||
247 | def _extract_original_format(self, url, video_id, unlisted_hash=None): | |
248 | query = {'action': 'load_download_config'} | |
249 | if unlisted_hash: | |
250 | query['unlisted_hash'] = unlisted_hash | |
251 | download_data = self._download_json( | |
252 | url, video_id, fatal=False, query=query, | |
253 | headers={'X-Requested-With': 'XMLHttpRequest'}, | |
254 | expected_status=(403, 404)) or {} | |
255 | source_file = download_data.get('source_file') | |
256 | download_url = try_get(source_file, lambda x: x['download_url']) | |
257 | if download_url and not source_file.get('is_cold') and not source_file.get('is_defrosting'): | |
258 | source_name = source_file.get('public_name', 'Original') | |
259 | if self._is_valid_url(download_url, video_id, f'{source_name} video'): | |
260 | ext = (try_get( | |
261 | source_file, lambda x: x['extension'], | |
262 | str) or determine_ext( | |
263 | download_url, None) or 'mp4').lower() | |
264 | return { | |
265 | 'url': download_url, | |
266 | 'ext': ext, | |
267 | 'width': int_or_none(source_file.get('width')), | |
268 | 'height': int_or_none(source_file.get('height')), | |
269 | 'filesize': parse_filesize(source_file.get('size')), | |
270 | 'format_id': source_name, | |
271 | 'quality': 1, | |
272 | } | |
273 | ||
274 | jwt_response = self._download_json( | |
275 | 'https://vimeo.com/_rv/viewer', video_id, note='Downloading jwt token', fatal=False) or {} | |
276 | if not jwt_response.get('jwt'): | |
277 | return | |
278 | headers = {'Authorization': 'jwt {}'.format(jwt_response['jwt']), 'Accept': 'application/json'} | |
279 | original_response = self._download_json( | |
280 | f'https://api.vimeo.com/videos/{video_id}', video_id, | |
281 | headers=headers, fatal=False, expected_status=(403, 404)) or {} | |
282 | for download_data in original_response.get('download') or []: | |
283 | download_url = download_data.get('link') | |
284 | if not download_url or download_data.get('quality') != 'source': | |
285 | continue | |
286 | ext = determine_ext(parse_qs(download_url).get('filename', [''])[0].lower(), default_ext=None) | |
287 | if not ext: | |
288 | urlh = self._request_webpage( | |
289 | HEADRequest(download_url), video_id, fatal=False, note='Determining source extension') | |
290 | ext = urlh and urlhandle_detect_ext(urlh) | |
291 | return { | |
292 | 'url': download_url, | |
293 | 'ext': ext or 'unknown_video', | |
294 | 'format_id': download_data.get('public_name', 'Original'), | |
295 | 'width': int_or_none(download_data.get('width')), | |
296 | 'height': int_or_none(download_data.get('height')), | |
297 | 'fps': int_or_none(download_data.get('fps')), | |
298 | 'filesize': int_or_none(download_data.get('size')), | |
299 | 'quality': 1, | |
300 | } | |
301 | ||
302 | ||
303 | class VimeoIE(VimeoBaseInfoExtractor): | |
304 | """Information extractor for vimeo.com.""" | |
305 | ||
306 | # _VALID_URL matches Vimeo URLs | |
307 | _VALID_URL = r'''(?x) | |
308 | https?:// | |
309 | (?: | |
310 | (?: | |
311 | www| | |
312 | player | |
313 | ) | |
314 | \. | |
315 | )? | |
316 | vimeo\.com/ | |
317 | (?: | |
318 | (?P<u>user)| | |
319 | (?!(?:channels|album|showcase)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/) | |
320 | (?:.*?/)?? | |
321 | (?P<q> | |
322 | (?: | |
323 | play_redirect_hls| | |
324 | moogaloop\.swf)\?clip_id= | |
325 | )? | |
326 | (?:videos?/)? | |
327 | ) | |
328 | (?P<id>[0-9]+) | |
329 | (?(u) | |
330 | /(?!videos|likes)[^/?#]+/?| | |
331 | (?(q)|/(?P<unlisted_hash>[\da-f]{10}))? | |
332 | ) | |
333 | (?:(?(q)[&]|(?(u)|/?)[?]).*?)?(?:[#].*)?$ | |
334 | ''' | |
335 | IE_NAME = 'vimeo' | |
336 | _EMBED_REGEX = [ | |
337 | # iframe | |
338 | r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//player\.vimeo\.com/video/\d+.*?)\1', | |
339 | # Embedded (swf embed) Vimeo player | |
340 | r'<embed[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)\1', | |
341 | # Non-standard embedded Vimeo player | |
342 | r'<video[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/[0-9]+)\1', | |
343 | ] | |
344 | _TESTS = [ | |
345 | { | |
346 | 'url': 'http://vimeo.com/56015672#at=0', | |
347 | 'md5': '8879b6cc097e987f02484baf890129e5', | |
348 | 'info_dict': { | |
349 | 'id': '56015672', | |
350 | 'ext': 'mp4', | |
351 | 'title': "youtube-dl test video '' ä↭𝕐-BaW jenozKc", | |
352 | 'description': 'md5:2d3305bad981a06ff79f027f19865021', | |
353 | 'timestamp': 1355990239, | |
354 | 'upload_date': '20121220', | |
355 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user7108434', | |
356 | 'uploader_id': 'user7108434', | |
357 | 'uploader': 'Filippo Valsorda', | |
358 | 'duration': 10, | |
359 | 'license': 'by-sa', | |
360 | }, | |
361 | 'params': { | |
362 | 'format': 'best[protocol=https]', | |
363 | }, | |
364 | 'skip': 'No longer available', | |
365 | }, | |
366 | { | |
367 | 'url': 'http://player.vimeo.com/video/54469442', | |
368 | 'md5': '619b811a4417aa4abe78dc653becf511', | |
369 | 'note': 'Videos that embed the url in the player page', | |
370 | 'info_dict': { | |
371 | 'id': '54469442', | |
372 | 'ext': 'mp4', | |
373 | 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012', | |
374 | 'uploader': 'Business of Software', | |
375 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/businessofsoftware', | |
376 | 'uploader_id': 'businessofsoftware', | |
377 | 'duration': 3610, | |
378 | 'thumbnail': 'https://i.vimeocdn.com/video/376682406-f34043e7b766af6bef2af81366eacd6724f3fc3173179a11a97a1e26587c9529-d_1280', | |
379 | }, | |
380 | 'params': { | |
381 | 'format': 'best[protocol=https]', | |
382 | }, | |
383 | }, | |
384 | { | |
385 | 'url': 'http://vimeo.com/68375962', | |
386 | 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7', | |
387 | 'note': 'Video protected with password', | |
388 | 'info_dict': { | |
389 | 'id': '68375962', | |
390 | 'ext': 'mp4', | |
391 | 'title': 'youtube-dl password protected test video', | |
392 | 'timestamp': 1371200155, | |
393 | 'upload_date': '20130614', | |
394 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user18948128', | |
395 | 'uploader_id': 'user18948128', | |
396 | 'uploader': 'Jaime Marquínez Ferrándiz', | |
397 | 'duration': 10, | |
398 | 'description': 'md5:6173f270cd0c0119f22817204b3eb86c', | |
399 | 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_1280', | |
400 | 'view_count': int, | |
401 | 'comment_count': int, | |
402 | 'like_count': int, | |
403 | }, | |
404 | 'params': { | |
405 | 'format': 'best[protocol=https]', | |
406 | 'videopassword': 'youtube-dl', | |
407 | }, | |
408 | }, | |
409 | { | |
410 | 'url': 'http://vimeo.com/channels/keypeele/75629013', | |
411 | 'md5': '2f86a05afe9d7abc0b9126d229bbe15d', | |
412 | 'info_dict': { | |
413 | 'id': '75629013', | |
414 | 'ext': 'mp4', | |
415 | 'title': 'Key & Peele: Terrorist Interrogation', | |
416 | 'description': 'md5:6173f270cd0c0119f22817204b3eb86c', | |
417 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/atencio', | |
418 | 'uploader_id': 'atencio', | |
419 | 'uploader': 'Peter Atencio', | |
420 | 'channel_id': 'keypeele', | |
421 | 'channel_url': r're:https?://(?:www\.)?vimeo\.com/channels/keypeele', | |
422 | 'timestamp': 1380339469, | |
423 | 'upload_date': '20130928', | |
424 | 'duration': 187, | |
425 | 'thumbnail': 'https://i.vimeocdn.com/video/450239872-a05512d9b1e55d707a7c04365c10980f327b06d966351bc403a5d5d65c95e572-d_1280', | |
426 | 'view_count': int, | |
427 | 'comment_count': int, | |
428 | 'like_count': int, | |
429 | }, | |
430 | 'params': {'format': 'http-1080p'}, | |
431 | }, | |
432 | { | |
433 | 'url': 'http://vimeo.com/76979871', | |
434 | 'note': 'Video with subtitles', | |
435 | 'info_dict': { | |
436 | 'id': '76979871', | |
437 | 'ext': 'mov', | |
438 | 'title': 'The New Vimeo Player (You Know, For Videos)', | |
439 | 'description': 'md5:2ec900bf97c3f389378a96aee11260ea', | |
440 | 'timestamp': 1381846109, | |
441 | 'upload_date': '20131015', | |
442 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/staff', | |
443 | 'uploader_id': 'staff', | |
444 | 'uploader': 'Vimeo Staff', | |
445 | 'duration': 62, | |
446 | 'subtitles': { | |
447 | 'de': [{'ext': 'vtt'}], | |
448 | 'en': [{'ext': 'vtt'}], | |
449 | 'es': [{'ext': 'vtt'}], | |
450 | 'fr': [{'ext': 'vtt'}], | |
451 | }, | |
452 | }, | |
453 | 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'], | |
454 | }, | |
455 | { | |
456 | # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/ | |
457 | 'url': 'https://player.vimeo.com/video/98044508', | |
458 | 'note': 'The js code contains assignments to the same variable as the config', | |
459 | 'info_dict': { | |
460 | 'id': '98044508', | |
461 | 'ext': 'mp4', | |
462 | 'title': 'Pier Solar OUYA Official Trailer', | |
463 | 'uploader': 'Tulio Gonçalves', | |
464 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user28849593', | |
465 | 'uploader_id': 'user28849593', | |
466 | 'duration': 118, | |
467 | 'thumbnail': 'https://i.vimeocdn.com/video/478636036-c18440305ef3df9decfb6bf207a61fe39d2d17fa462a96f6f2d93d30492b037d-d_1280', | |
468 | }, | |
469 | }, | |
470 | { | |
471 | # contains original format | |
472 | 'url': 'https://vimeo.com/33951933', | |
473 | 'md5': '53c688fa95a55bf4b7293d37a89c5c53', | |
474 | 'info_dict': { | |
475 | 'id': '33951933', | |
476 | 'ext': 'mp4', | |
477 | 'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute', | |
478 | 'uploader': 'The DMCI', | |
479 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/dmci', | |
480 | 'uploader_id': 'dmci', | |
481 | 'timestamp': 1324343742, | |
482 | 'upload_date': '20111220', | |
483 | 'description': 'md5:ae23671e82d05415868f7ad1aec21147', | |
484 | 'duration': 60, | |
485 | 'comment_count': int, | |
486 | 'view_count': int, | |
487 | 'thumbnail': 'https://i.vimeocdn.com/video/231174622-dd07f015e9221ff529d451e1cc31c982b5d87bfafa48c4189b1da72824ee289a-d_1280', | |
488 | 'like_count': int, | |
489 | }, | |
490 | }, | |
491 | { | |
492 | 'note': 'Contains original format not accessible in webpage', | |
493 | 'url': 'https://vimeo.com/393756517', | |
494 | 'md5': 'c464af248b592190a5ffbb5d33f382b0', | |
495 | 'info_dict': { | |
496 | 'id': '393756517', | |
497 | 'ext': 'mov', | |
498 | 'timestamp': 1582642091, | |
499 | 'uploader_id': 'frameworkla', | |
500 | 'title': 'Straight To Hell - Sabrina: Netflix', | |
501 | 'uploader': 'Framework Studio', | |
502 | 'description': 'md5:f2edc61af3ea7a5592681ddbb683db73', | |
503 | 'upload_date': '20200225', | |
504 | 'duration': 176, | |
505 | 'thumbnail': 'https://i.vimeocdn.com/video/859377297-836494a4ef775e9d4edbace83937d9ad34dc846c688c0c419c0e87f7ab06c4b3-d_1280', | |
506 | 'uploader_url': 'https://vimeo.com/frameworkla', | |
507 | }, | |
508 | }, | |
509 | { | |
510 | # only available via https://vimeo.com/channels/tributes/6213729 and | |
511 | # not via https://vimeo.com/6213729 | |
512 | 'url': 'https://vimeo.com/channels/tributes/6213729', | |
513 | 'info_dict': { | |
514 | 'id': '6213729', | |
515 | 'ext': 'mp4', | |
516 | 'title': 'Vimeo Tribute: The Shining', | |
517 | 'uploader': 'Casey Donahue', | |
518 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/caseydonahue', | |
519 | 'uploader_id': 'caseydonahue', | |
520 | 'channel_url': r're:https?://(?:www\.)?vimeo\.com/channels/tributes', | |
521 | 'channel_id': 'tributes', | |
522 | 'timestamp': 1250886430, | |
523 | 'upload_date': '20090821', | |
524 | 'description': 'md5:bdbf314014e58713e6e5b66eb252f4a6', | |
525 | 'duration': 321, | |
526 | 'comment_count': int, | |
527 | 'view_count': int, | |
528 | 'thumbnail': 'https://i.vimeocdn.com/video/22728298-bfc22146f930de7cf497821c7b0b9f168099201ecca39b00b6bd31fcedfca7a6-d_1280', | |
529 | 'like_count': int, | |
530 | }, | |
531 | 'params': { | |
532 | 'skip_download': True, | |
533 | }, | |
534 | }, | |
535 | { | |
536 | # redirects to ondemand extractor and should be passed through it | |
537 | # for successful extraction | |
538 | 'url': 'https://vimeo.com/73445910', | |
539 | 'info_dict': { | |
540 | 'id': '73445910', | |
541 | 'ext': 'mp4', | |
542 | 'title': 'The Reluctant Revolutionary', | |
543 | 'uploader': '10Ft Films', | |
544 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/tenfootfilms', | |
545 | 'uploader_id': 'tenfootfilms', | |
546 | 'description': 'md5:0fa704e05b04f91f40b7f3ca2e801384', | |
547 | 'upload_date': '20130830', | |
548 | 'timestamp': 1377853339, | |
549 | }, | |
550 | 'params': { | |
551 | 'skip_download': True, | |
552 | }, | |
553 | 'skip': 'this page is no longer available.', | |
554 | }, | |
555 | { | |
556 | 'url': 'http://player.vimeo.com/video/68375962', | |
557 | 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7', | |
558 | 'info_dict': { | |
559 | 'id': '68375962', | |
560 | 'ext': 'mp4', | |
561 | 'title': 'youtube-dl password protected test video', | |
562 | 'timestamp': 1371200155, | |
563 | 'upload_date': '20130614', | |
564 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user18948128', | |
565 | 'uploader_id': 'user18948128', | |
566 | 'uploader': 'Jaime Marquínez Ferrándiz', | |
567 | 'duration': 10, | |
568 | 'description': 'md5:6173f270cd0c0119f22817204b3eb86c', | |
569 | 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_1280', | |
570 | 'view_count': int, | |
571 | 'comment_count': int, | |
572 | 'like_count': int, | |
573 | }, | |
574 | 'params': { | |
575 | 'format': 'best[protocol=https]', | |
576 | 'videopassword': 'youtube-dl', | |
577 | }, | |
578 | }, | |
579 | { | |
580 | 'url': 'http://vimeo.com/moogaloop.swf?clip_id=2539741', | |
581 | 'only_matching': True, | |
582 | }, | |
583 | { | |
584 | 'url': 'https://vimeo.com/109815029', | |
585 | 'note': 'Video not completely processed, "failed" seed status', | |
586 | 'only_matching': True, | |
587 | }, | |
588 | { | |
589 | 'url': 'https://vimeo.com/groups/travelhd/videos/22439234', | |
590 | 'only_matching': True, | |
591 | }, | |
592 | { | |
593 | 'url': 'https://vimeo.com/album/2632481/video/79010983', | |
594 | 'only_matching': True, | |
595 | }, | |
596 | { | |
597 | 'url': 'https://vimeo.com/showcase/3253534/video/119195465', | |
598 | 'note': 'A video in a password protected album (showcase)', | |
599 | 'info_dict': { | |
600 | 'id': '119195465', | |
601 | 'ext': 'mp4', | |
602 | 'title': "youtube-dl test video '' ä↭𝕐-BaW jenozKc", | |
603 | 'uploader': 'Philipp Hagemeister', | |
604 | 'uploader_id': 'user20132939', | |
605 | 'description': 'md5:fa7b6c6d8db0bdc353893df2f111855b', | |
606 | 'upload_date': '20150209', | |
607 | 'timestamp': 1423518307, | |
608 | 'thumbnail': 'https://i.vimeocdn.com/video/default_1280', | |
609 | 'duration': 10, | |
610 | 'like_count': int, | |
611 | 'uploader_url': 'https://vimeo.com/user20132939', | |
612 | 'view_count': int, | |
613 | 'comment_count': int, | |
614 | }, | |
615 | 'params': { | |
616 | 'format': 'best[protocol=https]', | |
617 | 'videopassword': 'youtube-dl', | |
618 | }, | |
619 | }, | |
620 | { | |
621 | # source file returns 403: Forbidden | |
622 | 'url': 'https://vimeo.com/7809605', | |
623 | 'only_matching': True, | |
624 | }, | |
625 | { | |
626 | 'note': 'Direct URL with hash', | |
627 | 'url': 'https://vimeo.com/160743502/abd0e13fb4', | |
628 | 'info_dict': { | |
629 | 'id': '160743502', | |
630 | 'ext': 'mp4', | |
631 | 'uploader': 'Julian Tryba', | |
632 | 'uploader_id': 'aliniamedia', | |
633 | 'title': 'Harrisville New Hampshire', | |
634 | 'timestamp': 1459259666, | |
635 | 'upload_date': '20160329', | |
636 | 'release_timestamp': 1459259666, | |
637 | 'license': 'by-nc', | |
638 | 'duration': 159, | |
639 | 'comment_count': int, | |
640 | 'thumbnail': 'https://i.vimeocdn.com/video/562802436-585eeb13b5020c6ac0f171a2234067938098f84737787df05ff0d767f6d54ee9-d_1280', | |
641 | 'like_count': int, | |
642 | 'uploader_url': 'https://vimeo.com/aliniamedia', | |
643 | 'release_date': '20160329', | |
644 | }, | |
645 | 'params': {'skip_download': True}, | |
646 | }, | |
647 | { | |
648 | 'url': 'https://vimeo.com/138909882', | |
649 | 'info_dict': { | |
650 | 'id': '138909882', | |
651 | 'ext': 'mp4', | |
652 | 'title': 'Eastnor Castle 2015 Firework Champions - The Promo!', | |
653 | 'description': 'md5:5967e090768a831488f6e74b7821b3c1', | |
654 | 'uploader_id': 'fireworkchampions', | |
655 | 'uploader': 'Firework Champions', | |
656 | 'upload_date': '20150910', | |
657 | 'timestamp': 1441901895, | |
658 | }, | |
659 | 'params': { | |
660 | 'skip_download': True, | |
661 | 'format': 'Original', | |
662 | }, | |
663 | }, | |
664 | { | |
665 | 'url': 'https://vimeo.com/channels/staffpicks/143603739', | |
666 | 'info_dict': { | |
667 | 'id': '143603739', | |
668 | 'ext': 'mp4', | |
669 | 'uploader': 'Karim Huu Do', | |
670 | 'timestamp': 1445846953, | |
671 | 'upload_date': '20151026', | |
672 | 'title': 'The Shoes - Submarine Feat. Blaine Harrison', | |
673 | 'uploader_id': 'karimhd', | |
674 | 'description': 'md5:8e2eea76de4504c2e8020a9bcfa1e843', | |
675 | 'channel_id': 'staffpicks', | |
676 | 'duration': 336, | |
677 | 'comment_count': int, | |
678 | 'view_count': int, | |
679 | 'thumbnail': 'https://i.vimeocdn.com/video/541243181-b593db36a16db2f0096f655da3f5a4dc46b8766d77b0f440df937ecb0c418347-d_1280', | |
680 | 'like_count': int, | |
681 | 'uploader_url': 'https://vimeo.com/karimhd', | |
682 | 'channel_url': 'https://vimeo.com/channels/staffpicks', | |
683 | }, | |
684 | 'params': {'skip_download': 'm3u8'}, | |
685 | }, | |
686 | { | |
687 | # requires passing unlisted_hash(a52724358e) to load_download_config request | |
688 | 'url': 'https://vimeo.com/392479337/a52724358e', | |
689 | 'only_matching': True, | |
690 | }, | |
691 | { | |
692 | # similar, but all numeric: ID must be 581039021, not 9603038895 | |
693 | # issue #29690 | |
694 | 'url': 'https://vimeo.com/581039021/9603038895', | |
695 | 'info_dict': { | |
696 | 'id': '581039021', | |
697 | 'ext': 'mp4', | |
698 | 'timestamp': 1627621014, | |
699 | 'release_timestamp': 1627621014, | |
700 | 'duration': 976, | |
701 | 'comment_count': int, | |
702 | 'thumbnail': 'https://i.vimeocdn.com/video/1202249320-4ddb2c30398c0dc0ee059172d1bd5ea481ad12f0e0e3ad01d2266f56c744b015-d_1280', | |
703 | 'like_count': int, | |
704 | 'uploader_url': 'https://vimeo.com/txwestcapital', | |
705 | 'release_date': '20210730', | |
706 | 'uploader': 'Christopher Inks', | |
707 | 'title': 'Thursday, July 29, 2021 BMA Evening Video Update', | |
708 | 'uploader_id': 'txwestcapital', | |
709 | 'upload_date': '20210730', | |
710 | }, | |
711 | 'params': { | |
712 | 'skip_download': True, | |
713 | }, | |
714 | }, | |
715 | { | |
716 | # user playlist alias -> https://vimeo.com/258705797 | |
717 | 'url': 'https://vimeo.com/user26785108/newspiritualguide', | |
718 | 'only_matching': True, | |
719 | }, | |
720 | # https://gettingthingsdone.com/workflowmap/ | |
721 | # vimeo embed with check-password page protected by Referer header | |
722 | ] | |
723 | ||
724 | @classmethod | |
725 | def _extract_embed_urls(cls, url, webpage): | |
726 | for embed_url in super()._extract_embed_urls(url, webpage): | |
727 | yield cls._smuggle_referrer(embed_url, url) | |
728 | ||
729 | @classmethod | |
730 | def _extract_url(cls, url, webpage): | |
731 | return next(cls._extract_embed_urls(url, webpage), None) | |
732 | ||
733 | def _verify_player_video_password(self, url, video_id, headers): | |
734 | password = self._get_video_password() | |
735 | data = urlencode_postdata({ | |
736 | 'password': base64.b64encode(password.encode()), | |
737 | }) | |
738 | headers = merge_dicts(headers, { | |
739 | 'Content-Type': 'application/x-www-form-urlencoded', | |
740 | }) | |
741 | checked = self._download_json( | |
742 | f'{urllib.parse.urlsplit(url)._replace(query=None).geturl()}/check-password', | |
743 | video_id, 'Verifying the password', data=data, headers=headers) | |
744 | if checked is False: | |
745 | raise ExtractorError('Wrong video password', expected=True) | |
746 | return checked | |
747 | ||
748 | def _extract_from_api(self, video_id, unlisted_hash=None): | |
749 | token = self._download_json( | |
750 | 'https://vimeo.com/_rv/jwt', video_id, headers={ | |
751 | 'X-Requested-With': 'XMLHttpRequest', | |
752 | })['token'] | |
753 | api_url = 'https://api.vimeo.com/videos/' + video_id | |
754 | if unlisted_hash: | |
755 | api_url += ':' + unlisted_hash | |
756 | video = self._download_json( | |
757 | api_url, video_id, headers={ | |
758 | 'Authorization': 'jwt ' + token, | |
759 | 'Accept': 'application/json', | |
760 | }, query={ | |
761 | 'fields': 'config_url,created_time,description,license,metadata.connections.comments.total,metadata.connections.likes.total,release_time,stats.plays', | |
762 | }) | |
763 | info = self._parse_config(self._download_json( | |
764 | video['config_url'], video_id), video_id) | |
765 | get_timestamp = lambda x: parse_iso8601(video.get(x + '_time')) | |
766 | info.update({ | |
767 | 'description': video.get('description'), | |
768 | 'license': video.get('license'), | |
769 | 'release_timestamp': get_timestamp('release'), | |
770 | 'timestamp': get_timestamp('created'), | |
771 | 'view_count': int_or_none(try_get(video, lambda x: x['stats']['plays'])), | |
772 | }) | |
773 | connections = try_get( | |
774 | video, lambda x: x['metadata']['connections'], dict) or {} | |
775 | for k in ('comment', 'like'): | |
776 | info[k + '_count'] = int_or_none(try_get(connections, lambda x: x[k + 's']['total'])) | |
777 | return info | |
778 | ||
779 | def _try_album_password(self, url): | |
780 | album_id = self._search_regex( | |
781 | r'vimeo\.com/(?:album|showcase)/([^/]+)', url, 'album id', default=None) | |
782 | if not album_id: | |
783 | return | |
784 | viewer = self._download_json( | |
785 | 'https://vimeo.com/_rv/viewer', album_id, fatal=False) | |
786 | if not viewer: | |
787 | webpage = self._download_webpage(url, album_id) | |
788 | viewer = self._parse_json(self._search_regex( | |
789 | r'bootstrap_data\s*=\s*({.+?})</script>', | |
790 | webpage, 'bootstrap data'), album_id)['viewer'] | |
791 | jwt = viewer['jwt'] | |
792 | album = self._download_json( | |
793 | 'https://api.vimeo.com/albums/' + album_id, | |
794 | album_id, headers={'Authorization': 'jwt ' + jwt, 'Accept': 'application/json'}, | |
795 | query={'fields': 'description,name,privacy'}) | |
796 | if try_get(album, lambda x: x['privacy']['view']) == 'password': | |
797 | password = self.get_param('videopassword') | |
798 | if not password: | |
799 | raise ExtractorError( | |
800 | 'This album is protected by a password, use the --video-password option', | |
801 | expected=True) | |
802 | self._set_vimeo_cookie('vuid', viewer['vuid']) | |
803 | try: | |
804 | self._download_json( | |
805 | f'https://vimeo.com/showcase/{album_id}/auth', | |
806 | album_id, 'Verifying the password', data=urlencode_postdata({ | |
807 | 'password': password, | |
808 | 'token': viewer['xsrft'], | |
809 | }), headers={ | |
810 | 'X-Requested-With': 'XMLHttpRequest', | |
811 | }) | |
812 | except ExtractorError as e: | |
813 | if isinstance(e.cause, HTTPError) and e.cause.status == 401: | |
814 | raise ExtractorError('Wrong password', expected=True) | |
815 | raise | |
816 | ||
817 | def _real_extract(self, url): | |
818 | url, data, headers = self._unsmuggle_headers(url) | |
819 | if 'Referer' not in headers: | |
820 | headers['Referer'] = url | |
821 | ||
822 | # Extract ID from URL | |
823 | mobj = self._match_valid_url(url).groupdict() | |
824 | video_id, unlisted_hash = mobj['id'], mobj.get('unlisted_hash') | |
825 | if unlisted_hash: | |
826 | return self._extract_from_api(video_id, unlisted_hash) | |
827 | ||
828 | if any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')): | |
829 | url = 'https://vimeo.com/' + video_id | |
830 | ||
831 | self._try_album_password(url) | |
832 | is_secure = urllib.parse.urlparse(url).scheme == 'https' | |
833 | try: | |
834 | # Retrieve video webpage to extract further information | |
835 | webpage, urlh = self._download_webpage_handle( | |
836 | url, video_id, headers=headers, impersonate=is_secure) | |
837 | redirect_url = urlh.url | |
838 | except ExtractorError as error: | |
839 | if not isinstance(error.cause, HTTPError) or error.cause.status not in (403, 429): | |
840 | raise | |
841 | errmsg = error.cause.response.read() | |
842 | if b'Because of its privacy settings, this video cannot be played here' in errmsg: | |
843 | raise ExtractorError( | |
844 | 'Cannot download embed-only video without embedding URL. Please call yt-dlp ' | |
845 | 'with the URL of the page that embeds this video.', expected=True) | |
846 | # 403 == vimeo.com TLS fingerprint or DC IP block; 429 == player.vimeo.com TLS FP block | |
847 | status = error.cause.status | |
848 | dcip_msg = 'If you are using a data center IP or VPN/proxy, your IP may be blocked' | |
849 | if target := error.cause.response.extensions.get('impersonate'): | |
850 | raise ExtractorError( | |
851 | f'Got HTTP Error {status} when using impersonate target "{target}". {dcip_msg}') | |
852 | elif not is_secure: | |
853 | raise ExtractorError(f'Got HTTP Error {status}. {dcip_msg}', expected=True) | |
854 | raise ExtractorError( | |
855 | 'This request has been blocked due to its TLS fingerprint. Install a ' | |
856 | 'required impersonation dependency if possible, or else if you are okay with ' | |
857 | f'{self._downloader._format_err("compromising your security/cookies", "light red")}, ' | |
858 | f'try replacing "https:" with "http:" in the input URL. {dcip_msg}.', expected=True) | |
859 | ||
860 | if '://player.vimeo.com/video/' in url: | |
861 | config = self._search_json( | |
862 | r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id) | |
863 | if config.get('view') == 4: | |
864 | config = self._verify_player_video_password( | |
865 | redirect_url, video_id, headers) | |
866 | return self._parse_config(config, video_id) | |
867 | ||
868 | if re.search(r'<form[^>]+?id="pw_form"', webpage): | |
869 | video_password = self._get_video_password() | |
870 | token, vuid = self._extract_xsrft_and_vuid(webpage) | |
871 | webpage = self._verify_video_password( | |
872 | redirect_url, video_id, video_password, token, vuid) | |
873 | ||
874 | vimeo_config = self._extract_vimeo_config(webpage, video_id, default=None) | |
875 | if vimeo_config: | |
876 | seed_status = vimeo_config.get('seed_status') or {} | |
877 | if seed_status.get('state') == 'failed': | |
878 | raise ExtractorError( | |
879 | '{} said: {}'.format(self.IE_NAME, seed_status['title']), | |
880 | expected=True) | |
881 | ||
882 | cc_license = None | |
883 | timestamp = None | |
884 | video_description = None | |
885 | info_dict = {} | |
886 | config_url = None | |
887 | ||
888 | channel_id = self._search_regex( | |
889 | r'vimeo\.com/channels/([^/]+)', url, 'channel id', default=None) | |
890 | if channel_id: | |
891 | config_url = self._html_search_regex( | |
892 | r'\bdata-config-url="([^"]+)"', webpage, 'config URL', default=None) | |
893 | video_description = clean_html(get_element_by_class('description', webpage)) | |
894 | info_dict.update({ | |
895 | 'channel_id': channel_id, | |
896 | 'channel_url': 'https://vimeo.com/channels/' + channel_id, | |
897 | }) | |
898 | if not config_url: | |
899 | page_config = self._parse_json(self._search_regex( | |
900 | r'vimeo\.(?:clip|vod_title)_page_config\s*=\s*({.+?});', | |
901 | webpage, 'page config', default='{}'), video_id, fatal=False) | |
902 | if not page_config: | |
903 | return self._extract_from_api(video_id) | |
904 | config_url = page_config['player']['config_url'] | |
905 | cc_license = page_config.get('cc_license') | |
906 | clip = page_config.get('clip') or {} | |
907 | timestamp = clip.get('uploaded_on') | |
908 | video_description = clean_html( | |
909 | clip.get('description') or page_config.get('description_html_escaped')) | |
910 | config = self._download_json(config_url, video_id) | |
911 | video = config.get('video') or {} | |
912 | vod = video.get('vod') or {} | |
913 | ||
914 | def is_rented(): | |
915 | if '>You rented this title.<' in webpage: | |
916 | return True | |
917 | if try_get(config, lambda x: x['user']['purchased']): | |
918 | return True | |
919 | for purchase_option in (vod.get('purchase_options') or []): | |
920 | if purchase_option.get('purchased'): | |
921 | return True | |
922 | label = purchase_option.get('label_string') | |
923 | if label and (label.startswith('You rented this') or label.endswith(' remaining')): | |
924 | return True | |
925 | return False | |
926 | ||
927 | if is_rented() and vod.get('is_trailer'): | |
928 | feature_id = vod.get('feature_id') | |
929 | if feature_id and not data.get('force_feature_id', False): | |
930 | return self.url_result(smuggle_url( | |
931 | f'https://player.vimeo.com/player/{feature_id}', | |
932 | {'force_feature_id': True}), 'Vimeo') | |
933 | ||
934 | if not video_description: | |
935 | video_description = self._html_search_regex( | |
936 | r'(?s)<div\s+class="[^"]*description[^"]*"[^>]*>(.*?)</div>', | |
937 | webpage, 'description', default=None) | |
938 | if not video_description: | |
939 | video_description = self._html_search_meta( | |
940 | ['description', 'og:description', 'twitter:description'], | |
941 | webpage, default=None) | |
942 | if not video_description: | |
943 | self.report_warning('Cannot find video description') | |
944 | ||
945 | if not timestamp: | |
946 | timestamp = self._search_regex( | |
947 | r'<time[^>]+datetime="([^"]+)"', webpage, | |
948 | 'timestamp', default=None) | |
949 | ||
950 | view_count = int_or_none(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count', default=None)) | |
951 | like_count = int_or_none(self._search_regex(r'UserLikes:(\d+)', webpage, 'like count', default=None)) | |
952 | comment_count = int_or_none(self._search_regex(r'UserComments:(\d+)', webpage, 'comment count', default=None)) | |
953 | ||
954 | formats = [] | |
955 | ||
956 | source_format = self._extract_original_format( | |
957 | 'https://vimeo.com/' + video_id, video_id, video.get('unlisted_hash')) | |
958 | if source_format: | |
959 | formats.append(source_format) | |
960 | ||
961 | info_dict_config = self._parse_config(config, video_id) | |
962 | formats.extend(info_dict_config['formats']) | |
963 | info_dict['_format_sort_fields'] = info_dict_config['_format_sort_fields'] | |
964 | ||
965 | json_ld = self._search_json_ld(webpage, video_id, default={}) | |
966 | ||
967 | if not cc_license: | |
968 | cc_license = self._search_regex( | |
969 | r'<link[^>]+rel=["\']license["\'][^>]+href=(["\'])(?P<license>(?:(?!\1).)+)\1', | |
970 | webpage, 'license', default=None, group='license') | |
971 | ||
972 | info_dict.update({ | |
973 | 'formats': formats, | |
974 | 'timestamp': unified_timestamp(timestamp), | |
975 | 'description': video_description, | |
976 | 'webpage_url': url, | |
977 | 'view_count': view_count, | |
978 | 'like_count': like_count, | |
979 | 'comment_count': comment_count, | |
980 | 'license': cc_license, | |
981 | }) | |
982 | ||
983 | return merge_dicts(info_dict, info_dict_config, json_ld) | |
984 | ||
985 | ||
986 | class VimeoOndemandIE(VimeoIE): # XXX: Do not subclass from concrete IE | |
987 | IE_NAME = 'vimeo:ondemand' | |
988 | _VALID_URL = r'https?://(?:www\.)?vimeo\.com/ondemand/(?:[^/]+/)?(?P<id>[^/?#&]+)' | |
989 | _TESTS = [{ | |
990 | # ondemand video not available via https://vimeo.com/id | |
991 | 'url': 'https://vimeo.com/ondemand/20704', | |
992 | 'md5': 'c424deda8c7f73c1dfb3edd7630e2f35', | |
993 | 'info_dict': { | |
994 | 'id': '105442900', | |
995 | 'ext': 'mp4', | |
996 | 'title': 'המעבדה - במאי יותם פלדמן', | |
997 | 'uploader': 'גם סרטים', | |
998 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/gumfilms', | |
999 | 'uploader_id': 'gumfilms', | |
1000 | 'description': 'md5:aeeba3dbd4d04b0fa98a4fdc9c639998', | |
1001 | 'upload_date': '20140906', | |
1002 | 'timestamp': 1410032453, | |
1003 | 'thumbnail': 'https://i.vimeocdn.com/video/488238335-d7bf151c364cff8d467f1b73784668fe60aae28a54573a35d53a1210ae283bd8-d_1280', | |
1004 | 'comment_count': int, | |
1005 | 'license': 'https://creativecommons.org/licenses/by-nc-nd/3.0/', | |
1006 | 'duration': 53, | |
1007 | 'view_count': int, | |
1008 | 'like_count': int, | |
1009 | }, | |
1010 | 'params': { | |
1011 | 'format': 'best[protocol=https]', | |
1012 | }, | |
1013 | 'expected_warnings': ['Unable to download JSON metadata'], | |
1014 | }, { | |
1015 | # requires Referer to be passed along with og:video:url | |
1016 | 'url': 'https://vimeo.com/ondemand/36938/126682985', | |
1017 | 'info_dict': { | |
1018 | 'id': '126584684', | |
1019 | 'ext': 'mp4', | |
1020 | 'title': 'Rävlock, rätt läte på rätt plats', | |
1021 | 'uploader': 'Lindroth & Norin', | |
1022 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/lindrothnorin', | |
1023 | 'uploader_id': 'lindrothnorin', | |
1024 | 'description': 'md5:c3c46a90529612c8279fb6af803fc0df', | |
1025 | 'upload_date': '20150502', | |
1026 | 'timestamp': 1430586422, | |
1027 | 'duration': 121, | |
1028 | 'comment_count': int, | |
1029 | 'view_count': int, | |
1030 | 'thumbnail': 'https://i.vimeocdn.com/video/517077723-7066ae1d9a79d3eb361334fb5d58ec13c8f04b52f8dd5eadfbd6fb0bcf11f613-d_1280', | |
1031 | 'like_count': int, | |
1032 | }, | |
1033 | 'params': { | |
1034 | 'skip_download': True, | |
1035 | }, | |
1036 | 'expected_warnings': ['Unable to download JSON metadata'], | |
1037 | }, { | |
1038 | 'url': 'https://vimeo.com/ondemand/nazmaalik', | |
1039 | 'only_matching': True, | |
1040 | }, { | |
1041 | 'url': 'https://vimeo.com/ondemand/141692381', | |
1042 | 'only_matching': True, | |
1043 | }, { | |
1044 | 'url': 'https://vimeo.com/ondemand/thelastcolony/150274832', | |
1045 | 'only_matching': True, | |
1046 | }] | |
1047 | ||
1048 | ||
1049 | class VimeoChannelIE(VimeoBaseInfoExtractor): | |
1050 | IE_NAME = 'vimeo:channel' | |
1051 | _VALID_URL = r'https://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])' | |
1052 | _MORE_PAGES_INDICATOR = r'<a.+?rel="next"' | |
1053 | _TITLE = None | |
1054 | _TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"' | |
1055 | _TESTS = [{ | |
1056 | 'url': 'https://vimeo.com/channels/tributes', | |
1057 | 'info_dict': { | |
1058 | 'id': 'tributes', | |
1059 | 'title': 'Vimeo Tributes', | |
1060 | }, | |
1061 | 'playlist_mincount': 22, | |
1062 | }] | |
1063 | _BASE_URL_TEMPL = 'https://vimeo.com/channels/%s' | |
1064 | ||
1065 | def _page_url(self, base_url, pagenum): | |
1066 | return f'{base_url}/videos/page:{pagenum}/' | |
1067 | ||
1068 | def _extract_list_title(self, webpage): | |
1069 | return self._TITLE or self._html_search_regex( | |
1070 | self._TITLE_RE, webpage, 'list title', fatal=False) | |
1071 | ||
1072 | def _title_and_entries(self, list_id, base_url): | |
1073 | for pagenum in itertools.count(1): | |
1074 | page_url = self._page_url(base_url, pagenum) | |
1075 | webpage = self._download_webpage( | |
1076 | page_url, list_id, | |
1077 | f'Downloading page {pagenum}') | |
1078 | ||
1079 | if pagenum == 1: | |
1080 | yield self._extract_list_title(webpage) | |
1081 | ||
1082 | # Try extracting href first since not all videos are available via | |
1083 | # short https://vimeo.com/id URL (e.g. https://vimeo.com/channels/tributes/6213729) | |
1084 | clips = re.findall( | |
1085 | r'id="clip_(\d+)"[^>]*>\s*<a[^>]+href="(/(?:[^/]+/)*\1)(?:[^>]+\btitle="([^"]+)")?', webpage) | |
1086 | if clips: | |
1087 | for video_id, video_url, video_title in clips: | |
1088 | yield self.url_result( | |
1089 | urllib.parse.urljoin(base_url, video_url), | |
1090 | VimeoIE.ie_key(), video_id=video_id, video_title=video_title) | |
1091 | # More relaxed fallback | |
1092 | else: | |
1093 | for video_id in re.findall(r'id=["\']clip_(\d+)', webpage): | |
1094 | yield self.url_result( | |
1095 | f'https://vimeo.com/{video_id}', | |
1096 | VimeoIE.ie_key(), video_id=video_id) | |
1097 | ||
1098 | if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None: | |
1099 | break | |
1100 | ||
1101 | def _extract_videos(self, list_id, base_url): | |
1102 | title_and_entries = self._title_and_entries(list_id, base_url) | |
1103 | list_title = next(title_and_entries) | |
1104 | return self.playlist_result(title_and_entries, list_id, list_title) | |
1105 | ||
1106 | def _real_extract(self, url): | |
1107 | channel_id = self._match_id(url) | |
1108 | return self._extract_videos(channel_id, self._BASE_URL_TEMPL % channel_id) | |
1109 | ||
1110 | ||
1111 | class VimeoUserIE(VimeoChannelIE): # XXX: Do not subclass from concrete IE | |
1112 | IE_NAME = 'vimeo:user' | |
1113 | _VALID_URL = r'https://vimeo\.com/(?!(?:[0-9]+|watchlater)(?:$|[?#/]))(?P<id>[^/]+)(?:/videos)?/?(?:$|[?#])' | |
1114 | _TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>' | |
1115 | _TESTS = [{ | |
1116 | 'url': 'https://vimeo.com/nkistudio/videos', | |
1117 | 'info_dict': { | |
1118 | 'title': 'Nki', | |
1119 | 'id': 'nkistudio', | |
1120 | }, | |
1121 | 'playlist_mincount': 66, | |
1122 | }, { | |
1123 | 'url': 'https://vimeo.com/nkistudio/', | |
1124 | 'only_matching': True, | |
1125 | }] | |
1126 | _BASE_URL_TEMPL = 'https://vimeo.com/%s' | |
1127 | ||
1128 | ||
1129 | class VimeoAlbumIE(VimeoBaseInfoExtractor): | |
1130 | IE_NAME = 'vimeo:album' | |
1131 | _VALID_URL = r'https://vimeo\.com/(?:album|showcase)/(?P<id>\d+)(?:$|[?#]|/(?!video))' | |
1132 | _TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>' | |
1133 | _TESTS = [{ | |
1134 | 'url': 'https://vimeo.com/album/2632481', | |
1135 | 'info_dict': { | |
1136 | 'id': '2632481', | |
1137 | 'title': 'Staff Favorites: November 2013', | |
1138 | }, | |
1139 | 'playlist_mincount': 13, | |
1140 | }, { | |
1141 | 'note': 'Password-protected album', | |
1142 | 'url': 'https://vimeo.com/album/3253534', | |
1143 | 'info_dict': { | |
1144 | 'title': 'test', | |
1145 | 'id': '3253534', | |
1146 | }, | |
1147 | 'playlist_count': 1, | |
1148 | 'params': { | |
1149 | 'videopassword': 'youtube-dl', | |
1150 | }, | |
1151 | }] | |
1152 | _PAGE_SIZE = 100 | |
1153 | ||
1154 | def _fetch_page(self, album_id, authorization, hashed_pass, page): | |
1155 | api_page = page + 1 | |
1156 | query = { | |
1157 | 'fields': 'link,uri', | |
1158 | 'page': api_page, | |
1159 | 'per_page': self._PAGE_SIZE, | |
1160 | } | |
1161 | if hashed_pass: | |
1162 | query['_hashed_pass'] = hashed_pass | |
1163 | try: | |
1164 | videos = self._download_json( | |
1165 | f'https://api.vimeo.com/albums/{album_id}/videos', | |
1166 | album_id, f'Downloading page {api_page}', query=query, headers={ | |
1167 | 'Authorization': 'jwt ' + authorization, | |
1168 | 'Accept': 'application/json', | |
1169 | })['data'] | |
1170 | except ExtractorError as e: | |
1171 | if isinstance(e.cause, HTTPError) and e.cause.status == 400: | |
1172 | return | |
1173 | raise | |
1174 | for video in videos: | |
1175 | link = video.get('link') | |
1176 | if not link: | |
1177 | continue | |
1178 | uri = video.get('uri') | |
1179 | video_id = self._search_regex(r'/videos/(\d+)', uri, 'video_id', default=None) if uri else None | |
1180 | yield self.url_result(link, VimeoIE.ie_key(), video_id) | |
1181 | ||
1182 | def _real_extract(self, url): | |
1183 | album_id = self._match_id(url) | |
1184 | viewer = self._download_json( | |
1185 | 'https://vimeo.com/_rv/viewer', album_id, fatal=False) | |
1186 | if not viewer: | |
1187 | webpage = self._download_webpage(url, album_id) | |
1188 | viewer = self._parse_json(self._search_regex( | |
1189 | r'bootstrap_data\s*=\s*({.+?})</script>', | |
1190 | webpage, 'bootstrap data'), album_id)['viewer'] | |
1191 | jwt = viewer['jwt'] | |
1192 | album = self._download_json( | |
1193 | 'https://api.vimeo.com/albums/' + album_id, | |
1194 | album_id, headers={'Authorization': 'jwt ' + jwt, 'Accept': 'application/json'}, | |
1195 | query={'fields': 'description,name,privacy'}) | |
1196 | hashed_pass = None | |
1197 | if try_get(album, lambda x: x['privacy']['view']) == 'password': | |
1198 | password = self.get_param('videopassword') | |
1199 | if not password: | |
1200 | raise ExtractorError( | |
1201 | 'This album is protected by a password, use the --video-password option', | |
1202 | expected=True) | |
1203 | self._set_vimeo_cookie('vuid', viewer['vuid']) | |
1204 | try: | |
1205 | hashed_pass = self._download_json( | |
1206 | f'https://vimeo.com/showcase/{album_id}/auth', | |
1207 | album_id, 'Verifying the password', data=urlencode_postdata({ | |
1208 | 'password': password, | |
1209 | 'token': viewer['xsrft'], | |
1210 | }), headers={ | |
1211 | 'X-Requested-With': 'XMLHttpRequest', | |
1212 | })['hashed_pass'] | |
1213 | except ExtractorError as e: | |
1214 | if isinstance(e.cause, HTTPError) and e.cause.status == 401: | |
1215 | raise ExtractorError('Wrong password', expected=True) | |
1216 | raise | |
1217 | entries = OnDemandPagedList(functools.partial( | |
1218 | self._fetch_page, album_id, jwt, hashed_pass), self._PAGE_SIZE) | |
1219 | return self.playlist_result( | |
1220 | entries, album_id, album.get('name'), album.get('description')) | |
1221 | ||
1222 | ||
1223 | class VimeoGroupsIE(VimeoChannelIE): # XXX: Do not subclass from concrete IE | |
1224 | IE_NAME = 'vimeo:group' | |
1225 | _VALID_URL = r'https://vimeo\.com/groups/(?P<id>[^/]+)(?:/(?!videos?/\d+)|$)' | |
1226 | _TESTS = [{ | |
1227 | 'url': 'https://vimeo.com/groups/meetup', | |
1228 | 'info_dict': { | |
1229 | 'id': 'meetup', | |
1230 | 'title': 'Vimeo Meetup!', | |
1231 | }, | |
1232 | 'playlist_mincount': 27, | |
1233 | }] | |
1234 | _BASE_URL_TEMPL = 'https://vimeo.com/groups/%s' | |
1235 | ||
1236 | ||
1237 | class VimeoReviewIE(VimeoBaseInfoExtractor): | |
1238 | IE_NAME = 'vimeo:review' | |
1239 | IE_DESC = 'Review pages on vimeo' | |
1240 | _VALID_URL = r'(?P<url>https://vimeo\.com/[^/]+/review/(?P<id>[^/]+)/[0-9a-f]{10})' | |
1241 | _TESTS = [{ | |
1242 | 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d', | |
1243 | 'md5': 'c507a72f780cacc12b2248bb4006d253', | |
1244 | 'info_dict': { | |
1245 | 'id': '75524534', | |
1246 | 'ext': 'mp4', | |
1247 | 'title': "DICK HARDWICK 'Comedian'", | |
1248 | 'uploader': 'Richard Hardwick', | |
1249 | 'uploader_id': 'user21297594', | |
1250 | 'description': "Comedian Dick Hardwick's five minute demo filmed in front of a live theater audience.\nEdit by Doug Mattocks", | |
1251 | 'duration': 304, | |
1252 | 'thumbnail': 'https://i.vimeocdn.com/video/450115033-43303819d9ebe24c2630352e18b7056d25197d09b3ae901abdac4c4f1d68de71-d_1280', | |
1253 | 'uploader_url': 'https://vimeo.com/user21297594', | |
1254 | }, | |
1255 | }, { | |
1256 | 'note': 'video player needs Referer', | |
1257 | 'url': 'https://vimeo.com/user22258446/review/91613211/13f927e053', | |
1258 | 'md5': '6295fdab8f4bf6a002d058b2c6dce276', | |
1259 | 'info_dict': { | |
1260 | 'id': '91613211', | |
1261 | 'ext': 'mp4', | |
1262 | 'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn', | |
1263 | 'uploader': 'DevWeek Events', | |
1264 | 'duration': 2773, | |
1265 | 'thumbnail': r're:^https?://.*\.jpg$', | |
1266 | 'uploader_id': 'user22258446', | |
1267 | }, | |
1268 | 'skip': 'video gone', | |
1269 | }, { | |
1270 | 'note': 'Password protected', | |
1271 | 'url': 'https://vimeo.com/user37284429/review/138823582/c4d865efde', | |
1272 | 'info_dict': { | |
1273 | 'id': '138823582', | |
1274 | 'ext': 'mp4', | |
1275 | 'title': 'EFFICIENT PICKUP MASTERCLASS MODULE 1', | |
1276 | 'uploader': 'TMB', | |
1277 | 'uploader_id': 'user37284429', | |
1278 | }, | |
1279 | 'params': { | |
1280 | 'videopassword': 'holygrail', | |
1281 | }, | |
1282 | 'skip': 'video gone', | |
1283 | }] | |
1284 | ||
1285 | def _real_extract(self, url): | |
1286 | page_url, video_id = self._match_valid_url(url).groups() | |
1287 | data = self._download_json( | |
1288 | page_url.replace('/review/', '/review/data/'), video_id) | |
1289 | if data.get('isLocked') is True: | |
1290 | video_password = self._get_video_password() | |
1291 | viewer = self._download_json( | |
1292 | 'https://vimeo.com/_rv/viewer', video_id) | |
1293 | webpage = self._verify_video_password( | |
1294 | 'https://vimeo.com/' + video_id, video_id, | |
1295 | video_password, viewer['xsrft'], viewer['vuid']) | |
1296 | clip_page_config = self._parse_json(self._search_regex( | |
1297 | r'window\.vimeo\.clip_page_config\s*=\s*({.+?});', | |
1298 | webpage, 'clip page config'), video_id) | |
1299 | config_url = clip_page_config['player']['config_url'] | |
1300 | clip_data = clip_page_config.get('clip') or {} | |
1301 | else: | |
1302 | clip_data = data['clipData'] | |
1303 | config_url = clip_data['configUrl'] | |
1304 | config = self._download_json(config_url, video_id) | |
1305 | info_dict = self._parse_config(config, video_id) | |
1306 | source_format = self._extract_original_format( | |
1307 | page_url + '/action', video_id) | |
1308 | if source_format: | |
1309 | info_dict['formats'].append(source_format) | |
1310 | info_dict['description'] = clean_html(clip_data.get('description')) | |
1311 | return info_dict | |
1312 | ||
1313 | ||
1314 | class VimeoWatchLaterIE(VimeoChannelIE): # XXX: Do not subclass from concrete IE | |
1315 | IE_NAME = 'vimeo:watchlater' | |
1316 | IE_DESC = 'Vimeo watch later list, ":vimeowatchlater" keyword (requires authentication)' | |
1317 | _VALID_URL = r'https://vimeo\.com/(?:home/)?watchlater|:vimeowatchlater' | |
1318 | _TITLE = 'Watch Later' | |
1319 | _LOGIN_REQUIRED = True | |
1320 | _TESTS = [{ | |
1321 | 'url': 'https://vimeo.com/watchlater', | |
1322 | 'only_matching': True, | |
1323 | }] | |
1324 | ||
1325 | def _page_url(self, base_url, pagenum): | |
1326 | url = f'{base_url}/page:{pagenum}/' | |
1327 | request = Request(url) | |
1328 | # Set the header to get a partial html page with the ids, | |
1329 | # the normal page doesn't contain them. | |
1330 | request.headers['X-Requested-With'] = 'XMLHttpRequest' | |
1331 | return request | |
1332 | ||
1333 | def _real_extract(self, url): | |
1334 | return self._extract_videos('watchlater', 'https://vimeo.com/watchlater') | |
1335 | ||
1336 | ||
1337 | class VimeoLikesIE(VimeoChannelIE): # XXX: Do not subclass from concrete IE | |
1338 | _VALID_URL = r'https://(?:www\.)?vimeo\.com/(?P<id>[^/]+)/likes/?(?:$|[?#]|sort:)' | |
1339 | IE_NAME = 'vimeo:likes' | |
1340 | IE_DESC = 'Vimeo user likes' | |
1341 | _TESTS = [{ | |
1342 | 'url': 'https://vimeo.com/user755559/likes/', | |
1343 | 'playlist_mincount': 293, | |
1344 | 'info_dict': { | |
1345 | 'id': 'user755559', | |
1346 | 'title': 'urza’s Likes', | |
1347 | }, | |
1348 | }, { | |
1349 | 'url': 'https://vimeo.com/stormlapse/likes', | |
1350 | 'only_matching': True, | |
1351 | }] | |
1352 | ||
1353 | def _page_url(self, base_url, pagenum): | |
1354 | return f'{base_url}/page:{pagenum}/' | |
1355 | ||
1356 | def _real_extract(self, url): | |
1357 | user_id = self._match_id(url) | |
1358 | return self._extract_videos(user_id, f'https://vimeo.com/{user_id}/likes') | |
1359 | ||
1360 | ||
1361 | class VHXEmbedIE(VimeoBaseInfoExtractor): | |
1362 | IE_NAME = 'vhx:embed' | |
1363 | _VALID_URL = r'https?://embed\.vhx\.tv/videos/(?P<id>\d+)' | |
1364 | _EMBED_REGEX = [r'<iframe[^>]+src="(?P<url>https?://embed\.vhx\.tv/videos/\d+[^"]*)"'] | |
1365 | ||
1366 | @classmethod | |
1367 | def _extract_embed_urls(cls, url, webpage): | |
1368 | for embed_url in super()._extract_embed_urls(url, webpage): | |
1369 | yield cls._smuggle_referrer(embed_url, url) | |
1370 | ||
1371 | def _real_extract(self, url): | |
1372 | video_id = self._match_id(url) | |
1373 | url, _, headers = self._unsmuggle_headers(url) | |
1374 | webpage = self._download_webpage(url, video_id, headers=headers) | |
1375 | config_url = self._parse_json(self._search_regex( | |
1376 | r'window\.OTTData\s*=\s*({.+})', webpage, | |
1377 | 'ott data'), video_id, js_to_json)['config_url'] | |
1378 | config = self._download_json(config_url, video_id) | |
1379 | info = self._parse_config(config, video_id) | |
1380 | info['id'] = video_id | |
1381 | return info | |
1382 | ||
1383 | ||
1384 | class VimeoProIE(VimeoBaseInfoExtractor): | |
1385 | IE_NAME = 'vimeo:pro' | |
1386 | _VALID_URL = r'https?://(?:www\.)?vimeopro\.com/[^/?#]+/(?P<slug>[^/?#]+)(?:(?:/videos?/(?P<id>[0-9]+)))?' | |
1387 | _TESTS = [{ | |
1388 | # Vimeo URL derived from video_id | |
1389 | 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876', | |
1390 | 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82', | |
1391 | 'note': 'Vimeo Pro video (#1197)', | |
1392 | 'info_dict': { | |
1393 | 'id': '68093876', | |
1394 | 'ext': 'mp4', | |
1395 | 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/openstreetmapus', | |
1396 | 'uploader_id': 'openstreetmapus', | |
1397 | 'uploader': 'OpenStreetMap US', | |
1398 | 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography', | |
1399 | 'description': 'md5:2c362968038d4499f4d79f88458590c1', | |
1400 | 'duration': 1595, | |
1401 | 'upload_date': '20130610', | |
1402 | 'timestamp': 1370893156, | |
1403 | 'license': 'by', | |
1404 | 'thumbnail': 'https://i.vimeocdn.com/video/440260469-19b0d92fca3bd84066623b53f1eb8aaa3980c6c809e2d67b6b39ab7b4a77a344-d_960', | |
1405 | 'view_count': int, | |
1406 | 'comment_count': int, | |
1407 | 'like_count': int, | |
1408 | 'tags': 'count:1', | |
1409 | }, | |
1410 | 'params': { | |
1411 | 'format': 'best[protocol=https]', | |
1412 | }, | |
1413 | }, { | |
1414 | # password-protected VimeoPro page with Vimeo player embed | |
1415 | 'url': 'https://vimeopro.com/cadfem/simulation-conference-mechanische-systeme-in-perfektion', | |
1416 | 'info_dict': { | |
1417 | 'id': '764543723', | |
1418 | 'ext': 'mp4', | |
1419 | 'title': 'Mechanische Systeme in Perfektion: Realität erfassen, Innovation treiben', | |
1420 | 'thumbnail': 'https://i.vimeocdn.com/video/1543784598-a1a750494a485e601110136b9fe11e28c2131942452b3a5d30391cb3800ca8fd-d_1280', | |
1421 | 'description': 'md5:2a9d195cd1b0f6f79827107dc88c2420', | |
1422 | 'uploader': 'CADFEM', | |
1423 | 'uploader_id': 'cadfem', | |
1424 | 'uploader_url': 'https://vimeo.com/cadfem', | |
1425 | 'duration': 12505, | |
1426 | 'chapters': 'count:10', | |
1427 | }, | |
1428 | 'params': { | |
1429 | 'videopassword': 'Conference2022', | |
1430 | 'skip_download': True, | |
1431 | }, | |
1432 | }] | |
1433 | ||
1434 | def _real_extract(self, url): | |
1435 | display_id, video_id = self._match_valid_url(url).group('slug', 'id') | |
1436 | if video_id: | |
1437 | display_id = video_id | |
1438 | webpage = self._download_webpage(url, display_id) | |
1439 | ||
1440 | password_form = self._search_regex( | |
1441 | r'(?is)<form[^>]+?method=["\']post["\'][^>]*>(.+?password.+?)</form>', | |
1442 | webpage, 'password form', default=None) | |
1443 | if password_form: | |
1444 | try: | |
1445 | webpage = self._download_webpage(url, display_id, data=urlencode_postdata({ | |
1446 | 'password': self._get_video_password(), | |
1447 | **self._hidden_inputs(password_form), | |
1448 | }), note='Logging in with video password') | |
1449 | except ExtractorError as e: | |
1450 | if isinstance(e.cause, HTTPError) and e.cause.status == 418: | |
1451 | raise ExtractorError('Wrong video password', expected=True) | |
1452 | raise | |
1453 | ||
1454 | description = None | |
1455 | # even if we have video_id, some videos require player URL with portfolio_id query param | |
1456 | # https://github.com/ytdl-org/youtube-dl/issues/20070 | |
1457 | vimeo_url = VimeoIE._extract_url(url, webpage) | |
1458 | if vimeo_url: | |
1459 | description = self._html_search_meta('description', webpage, default=None) | |
1460 | elif video_id: | |
1461 | vimeo_url = f'https://vimeo.com/{video_id}' | |
1462 | else: | |
1463 | raise ExtractorError( | |
1464 | 'No Vimeo embed or video ID could be found in VimeoPro page', expected=True) | |
1465 | ||
1466 | return self.url_result(vimeo_url, VimeoIE, video_id, url_transparent=True, | |
1467 | description=description) |