8 from .common
import InfoExtractor
9 from ..networking
import HEADRequest
, Request
10 from ..networking
.exceptions
import HTTPError
37 class VimeoBaseInfoExtractor(InfoExtractor
):
38 _NETRC_MACHINE
= 'vimeo'
39 _LOGIN_REQUIRED
= False
40 _LOGIN_URL
= 'https://vimeo.com/log_in'
43 def _smuggle_referrer(url
, referrer_url
):
44 return smuggle_url(url
, {'referer': referrer_url
})
46 def _unsmuggle_headers(self
, url
):
47 """@returns (url, smuggled_data, headers)"""
48 url
, data
= unsmuggle_url(url
, {})
49 headers
= self
.get_param('http_headers').copy()
51 headers
['Referer'] = data
['referer']
52 return url
, data
, headers
54 def _perform_login(self
, username
, password
):
55 viewer
= self
._download
_json
('https://vimeo.com/_next/viewer', None, 'Downloading login token')
61 'token': viewer
['xsrft'],
63 self
._set
_vimeo
_cookie
('vuid', viewer
['vuid'])
65 self
._download
_webpage
(
66 self
._LOGIN
_URL
, None, 'Logging in',
67 data
=urlencode_postdata(data
), headers
={
68 'Content-Type': 'application/x-www-form-urlencoded',
69 'Referer': self
._LOGIN
_URL
,
71 except ExtractorError
as e
:
72 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 418:
74 'Unable to log in: bad username or password',
76 raise ExtractorError('Unable to log in')
78 def _real_initialize(self
):
79 if self
._LOGIN
_REQUIRED
and not self
._get
_cookies
('https://vimeo.com').get('vuid'):
80 self
._raise
_login
_required
()
82 def _get_video_password(self
):
83 password
= self
.get_param('videopassword')
86 'This video is protected by a password, use the --video-password option',
90 def _verify_video_password(self
, video_id
, password
, token
):
91 url
= f
'https://vimeo.com/{video_id}'
93 return self
._download
_webpage
(
94 f
'{url}/password', video_id
,
95 'Submitting video password', data
=json
.dumps({
98 }, separators
=(',', ':')).encode(), headers
={
100 'Content-Type': 'application/json',
103 except ExtractorError
as error
:
104 if isinstance(error
.cause
, HTTPError
) and error
.cause
.status
== 418:
105 raise ExtractorError('Wrong password', expected
=True)
108 def _extract_vimeo_config(self
, webpage
, video_id
, *args
, **kwargs
):
109 vimeo_config
= self
._search
_regex
(
110 r
'vimeo\.config\s*=\s*(?:({.+?})|_extend\([^,]+,\s+({.+?})\));',
111 webpage
, 'vimeo config', *args
, **kwargs
)
113 return self
._parse
_json
(vimeo_config
, video_id
)
115 def _set_vimeo_cookie(self
, name
, value
):
116 self
._set
_cookie
('vimeo.com', name
, value
)
118 def _parse_config(self
, config
, video_id
):
119 video_data
= config
['video']
120 video_title
= video_data
.get('title')
121 live_event
= video_data
.get('live_event') or {}
123 'pending': 'is_upcoming',
124 'active': 'is_upcoming',
125 'started': 'is_live',
126 'ended': 'post_live',
127 }.get(live_event
.get('status'))
128 is_live
= live_status
== 'is_live'
129 request
= config
.get('request') or {}
134 config_files
= video_data
.get('files') or request
.get('files') or {}
135 for f
in (config_files
.get('progressive') or []):
136 video_url
= f
.get('url')
141 'format_id': 'http-{}'.format(f
.get('quality')),
142 'source_preference': 10,
143 'width': int_or_none(f
.get('width')),
144 'height': int_or_none(f
.get('height')),
145 'fps': int_or_none(f
.get('fps')),
146 'tbr': int_or_none(f
.get('bitrate')),
149 # TODO: fix handling of 308 status code returned for live archive manifest requests
150 QUALITIES
= ('low', 'medium', 'high')
151 quality
= qualities(QUALITIES
)
152 sep_pattern
= r
'/sep/video/'
153 for files_type
in ('hls', 'dash'):
154 for cdn_name
, cdn_data
in (try_get(config_files
, lambda x
: x
[files_type
]['cdns']) or {}).items():
155 manifest_url
= cdn_data
.get('url')
158 format_id
= f
'{files_type}-{cdn_name}'
159 sep_manifest_urls
= []
160 if re
.search(sep_pattern
, manifest_url
):
161 for suffix
, repl
in (('', 'video'), ('_sep', 'sep/video')):
162 sep_manifest_urls
.append((format_id
+ suffix
, re
.sub(
163 sep_pattern
, f
'/{repl}/', manifest_url
)))
165 sep_manifest_urls
= [(format_id
, manifest_url
)]
166 for f_id
, m_url
in sep_manifest_urls
:
167 if files_type
== 'hls':
168 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
169 m_url
, video_id
, 'mp4', live
=is_live
, m3u8_id
=f_id
,
170 note
=f
'Downloading {cdn_name} m3u8 information',
172 # m3u8 doesn't give audio bitrates; need to prioritize based on GROUP-ID
173 # See: https://github.com/yt-dlp/yt-dlp/issues/10854
175 if mobj
:= re
.search(rf
'audio-({"|".join(QUALITIES)})', f
['format_id']):
176 f
['quality'] = quality(mobj
.group(1))
178 self
._merge
_subtitles
(subs
, target
=subtitles
)
179 elif files_type
== 'dash':
180 if 'json=1' in m_url
:
181 real_m_url
= (self
._download
_json
(m_url
, video_id
, fatal
=False) or {}).get('url')
184 fmts
, subs
= self
._extract
_mpd
_formats
_and
_subtitles
(
185 m_url
.replace('/master.json', '/master.mpd'), video_id
, f_id
,
186 f
'Downloading {cdn_name} MPD information',
189 self
._merge
_subtitles
(subs
, target
=subtitles
)
191 live_archive
= live_event
.get('archive') or {}
192 live_archive_source_url
= live_archive
.get('source_url')
193 if live_archive_source_url
and live_archive
.get('status') == 'done':
195 'format_id': 'live-archive-source',
196 'url': live_archive_source_url
,
200 for tt
in (request
.get('text_tracks') or []):
201 subtitles
.setdefault(tt
['lang'], []).append({
203 'url': urljoin('https://vimeo.com', tt
['url']),
208 for key
, thumb
in (video_data
.get('thumbs') or {}).items():
211 'width': int_or_none(key
),
214 thumbnail
= video_data
.get('thumbnail')
220 owner
= video_data
.get('owner') or {}
221 video_uploader_url
= owner
.get('url')
224 'id': str_or_none(video_data
.get('id')) or video_id
,
225 'title': video_title
,
226 'uploader': owner
.get('name'),
227 'uploader_id': video_uploader_url
.split('/')[-1] if video_uploader_url
else None,
228 'uploader_url': video_uploader_url
,
229 'thumbnails': thumbnails
,
230 'duration': int_or_none(video_data
.get('duration')),
231 'chapters': sorted(traverse_obj(config
, (
232 'embed', 'chapters', lambda _
, v
: int(v
['timecode']) is not None, {
233 'title': ('title', {str}
),
234 'start_time': ('timecode', {int_or_none}
),
235 })), key
=lambda c
: c
['start_time']) or None,
237 'subtitles': subtitles
,
238 'live_status': live_status
,
239 'release_timestamp': traverse_obj(live_event
, ('ingest', 'scheduled_start_time', {parse_iso8601}
)),
240 # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
241 # at the same time without actual units specified.
242 '_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'),
245 def _call_videos_api(self
, video_id
, jwt_token
, unlisted_hash
=None, **kwargs
):
246 return self
._download
_json
(
247 join_nonempty(f
'https://api.vimeo.com/videos/{video_id}', unlisted_hash
, delim
=':'),
248 video_id
, 'Downloading API JSON', headers
={
249 'Authorization': f
'jwt {jwt_token}',
250 'Accept': 'application/json',
253 'config_url', 'created_time', 'description', 'download', 'license',
254 'metadata.connections.comments.total', 'metadata.connections.likes.total',
255 'release_time', 'stats.plays')),
258 def _extract_original_format(self
, url
, video_id
, unlisted_hash
=None, jwt
=None, api_data
=None):
259 # Original/source formats are only available when logged in
260 if not self
._get
_cookies
('https://vimeo.com/').get('vimeo'):
263 query
= {'action': 'load_download_config'}
265 query
['unlisted_hash'] = unlisted_hash
266 download_data
= self
._download
_json
(
267 url
, video_id
, 'Loading download config JSON', fatal
=False,
268 query
=query
, headers
={'X-Requested-With': 'XMLHttpRequest'},
269 expected_status
=(403, 404)) or {}
270 source_file
= download_data
.get('source_file')
271 download_url
= try_get(source_file
, lambda x
: x
['download_url'])
272 if download_url
and not source_file
.get('is_cold') and not source_file
.get('is_defrosting'):
273 source_name
= source_file
.get('public_name', 'Original')
274 if self
._is
_valid
_url
(download_url
, video_id
, f
'{source_name} video'):
276 source_file
, lambda x
: x
['extension'],
277 str) or determine_ext(
278 download_url
, None) or 'mp4').lower()
282 'width': int_or_none(source_file
.get('width')),
283 'height': int_or_none(source_file
.get('height')),
284 'filesize': parse_filesize(source_file
.get('size')),
285 'format_id': source_name
,
289 jwt
= jwt
or traverse_obj(self
._download
_json
(
290 'https://vimeo.com/_rv/viewer', video_id
, 'Downloading jwt token', fatal
=False), ('jwt', {str}
))
293 original_response
= api_data
or self
._call
_videos
_api
(
294 video_id
, jwt
, unlisted_hash
, fatal
=False, expected_status
=(403, 404))
295 for download_data
in traverse_obj(original_response
, ('download', ..., {dict}
)):
296 download_url
= download_data
.get('link')
297 if not download_url
or download_data
.get('quality') != 'source':
299 ext
= determine_ext(parse_qs(download_url
).get('filename', [''])[0].lower(), default_ext
=None)
301 urlh
= self
._request
_webpage
(
302 HEADRequest(download_url
), video_id
, fatal
=False, note
='Determining source extension')
303 ext
= urlh
and urlhandle_detect_ext(urlh
)
306 'ext': ext
or 'unknown_video',
307 'format_id': download_data
.get('public_name', 'Original'),
308 'width': int_or_none(download_data
.get('width')),
309 'height': int_or_none(download_data
.get('height')),
310 'fps': int_or_none(download_data
.get('fps')),
311 'filesize': int_or_none(download_data
.get('size')),
316 class VimeoIE(VimeoBaseInfoExtractor
):
317 """Information extractor for vimeo.com."""
319 # _VALID_URL matches Vimeo URLs
320 _VALID_URL
= r
'''(?x)
332 (?!(?:channels|album|showcase)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/)
337 moogaloop\.swf)\?clip_id=
343 /(?!videos|likes)[^/?#]+/?|
344 (?(q)|/(?P<unlisted_hash>[\da-f]{10}))?
346 (?:(?(q)[&]|(?(u)|/?)[?]).*?)?(?:[#].*)?$
351 r
'<iframe[^>]+?src=(["\'])(?P
<url
>(?
:https?
:)?
//player\
.vimeo\
.com
/video
/\d
+.*?
)\
1',
352 # Embedded (swf embed) Vimeo player
353 r'<embed
[^
>]+?src
=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)\1',
354 # Non-standard embedded Vimeo player
355 r'<video[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//(?
:www\
.)?vimeo\
.com
/[0-9]+)\
1',
359 'url
': 'http
://vimeo
.com
/56015672#at=0',
360 'md5': '8879b6cc097e987f02484baf890129e5',
364 'title': "youtube-dl test video '' ä↭𝕐-BaW jenozKc",
365 'description': 'md5:2d3305bad981a06ff79f027f19865021',
366 'timestamp': 1355990239,
367 'upload_date': '20121220',
368 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user7108434',
369 'uploader_id': 'user7108434',
370 'uploader': 'Filippo Valsorda',
375 'format': 'best[protocol=https]',
377 'skip': 'No longer available',
380 'url': 'https://player.vimeo.com/video/54469442',
381 'md5': '619b811a4417aa4abe78dc653becf511',
382 'note': 'Videos that embed the url in the player page',
386 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
387 'uploader': 'Business of Software',
388 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/businessofsoftware',
389 'uploader_id': 'businessofsoftware',
391 'thumbnail': 'https://i.vimeocdn.com/video/376682406-f34043e7b766af6bef2af81366eacd6724f3fc3173179a11a97a1e26587c9529-d_1280',
394 'format': 'best[protocol=https]',
396 'expected_warnings': ['Failed to parse XML: not well-formed'],
399 'url': 'http://vimeo.com/68375962',
400 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
401 'note': 'Video protected with password',
405 'title': 'youtube-dl password protected test video',
406 'timestamp': 1371214555,
407 'upload_date': '20130614',
408 'release_timestamp': 1371214555,
409 'release_date': '20130614',
410 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user18948128',
411 'uploader_id': 'user18948128',
412 'uploader': 'Jaime Marquínez Ferrándiz',
414 'comment_count': int,
416 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_1280',
419 'format': 'best[protocol=https]',
420 'videopassword': 'youtube-dl',
422 'expected_warnings': ['Failed to parse XML: not well-formed'],
425 'url': 'http://vimeo.com/channels/keypeele/75629013',
426 'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
430 'title': 'Key & Peele: Terrorist Interrogation',
431 'description': 'md5:6173f270cd0c0119f22817204b3eb86c',
432 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/atencio',
433 'uploader_id': 'atencio',
434 'uploader': 'Peter Atencio',
435 'channel_id': 'keypeele',
436 'channel_url': r
're:https?://(?:www\.)?vimeo\.com/channels/keypeele',
437 'timestamp': 1380339469,
438 'upload_date': '20130928',
440 'thumbnail': 'https://i.vimeocdn.com/video/450239872-a05512d9b1e55d707a7c04365c10980f327b06d966351bc403a5d5d65c95e572-d_1280',
442 'comment_count': int,
445 'params': {'format': 'http-1080p'},
446 'expected_warnings': ['Failed to parse XML: not well-formed'],
449 'url': 'http://vimeo.com/76979871',
450 'note': 'Video with subtitles',
454 'title': 'The New Vimeo Player (You Know, For Videos)',
455 'description': str, # FIXME: Dynamic SEO spam description
456 'timestamp': 1381860509,
457 'upload_date': '20131015',
458 'release_timestamp': 1381860509,
459 'release_date': '20131015',
460 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/staff',
461 'uploader_id': 'staff',
464 'comment_count': int,
466 'thumbnail': 'https://i.vimeocdn.com/video/452001751-8216e0571c251a09d7a8387550942d89f7f86f6398f8ed886e639b0dd50d3c90-d_1280',
474 'expected_warnings': [
475 'Ignoring subtitle tracks found in the HLS manifest',
476 'Failed to parse XML: not well-formed',
480 # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/
481 'url': 'https://player.vimeo.com/video/98044508',
482 'note': 'The js code contains assignments to the same variable as the config',
486 'title': 'Pier Solar OUYA Official Trailer',
487 'uploader': 'Tulio Gonçalves',
488 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user28849593',
489 'uploader_id': 'user28849593',
491 'thumbnail': 'https://i.vimeocdn.com/video/478636036-c18440305ef3df9decfb6bf207a61fe39d2d17fa462a96f6f2d93d30492b037d-d_1280',
493 'expected_warnings': ['Failed to parse XML: not well-formed'],
496 # contains Original format
497 'url': 'https://vimeo.com/33951933',
498 # 'md5': '53c688fa95a55bf4b7293d37a89c5c53',
502 'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute',
503 'uploader': 'The DMCI',
504 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/dmci',
505 'uploader_id': 'dmci',
506 'timestamp': 1324343742,
507 'upload_date': '20111220',
508 'description': 'md5:ae23671e82d05415868f7ad1aec21147',
510 'comment_count': int,
512 'thumbnail': 'https://i.vimeocdn.com/video/231174622-dd07f015e9221ff529d451e1cc31c982b5d87bfafa48c4189b1da72824ee289a-d_1280',
516 # 'params': {'format': 'Original'},
517 'expected_warnings': ['Failed to parse XML: not well-formed'],
520 'note': 'Contains source format not accessible in webpage',
521 'url': 'https://vimeo.com/393756517',
522 # 'md5': 'c464af248b592190a5ffbb5d33f382b0',
527 'timestamp': 1582642091,
528 'uploader_id': 'frameworkla',
529 'title': 'Straight To Hell - Sabrina: Netflix',
530 'uploader': 'Framework Studio',
531 'description': 'md5:f2edc61af3ea7a5592681ddbb683db73',
532 'upload_date': '20200225',
534 'thumbnail': 'https://i.vimeocdn.com/video/859377297-836494a4ef775e9d4edbace83937d9ad34dc846c688c0c419c0e87f7ab06c4b3-d_1280',
535 'uploader_url': 'https://vimeo.com/frameworkla',
537 # 'params': {'format': 'source'},
538 'expected_warnings': ['Failed to parse XML: not well-formed'],
541 # only available via https://vimeo.com/channels/tributes/6213729 and
542 # not via https://vimeo.com/6213729
543 'url': 'https://vimeo.com/channels/tributes/6213729',
547 'title': 'Vimeo Tribute: The Shining',
548 'uploader': 'Casey Donahue',
549 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/caseydonahue',
550 'uploader_id': 'caseydonahue',
551 'channel_url': r
're:https?://(?:www\.)?vimeo\.com/channels/tributes',
552 'channel_id': 'tributes',
553 'timestamp': 1250886430,
554 'upload_date': '20090821',
555 'description': str, # FIXME: Dynamic SEO spam description
557 'comment_count': int,
559 'thumbnail': 'https://i.vimeocdn.com/video/22728298-bfc22146f930de7cf497821c7b0b9f168099201ecca39b00b6bd31fcedfca7a6-d_1280',
561 'tags': ['[the shining', 'vimeohq', 'cv', 'vimeo tribute]'],
564 'skip_download': True,
566 'expected_warnings': ['Failed to parse XML: not well-formed'],
569 # redirects to ondemand extractor and should be passed through it
570 # for successful extraction
571 'url': 'https://vimeo.com/73445910',
575 'title': 'The Reluctant Revolutionary',
576 'uploader': '10Ft Films',
577 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/tenfootfilms',
578 'uploader_id': 'tenfootfilms',
579 'description': 'md5:0fa704e05b04f91f40b7f3ca2e801384',
580 'upload_date': '20130830',
581 'timestamp': 1377853339,
584 'skip_download': True,
586 'skip': 'this page is no longer available.',
589 'url': 'https://player.vimeo.com/video/68375962',
590 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
594 'title': 'youtube-dl password protected test video',
595 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user18948128',
596 'uploader_id': 'user18948128',
597 'uploader': 'Jaime Marquínez Ferrándiz',
599 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_1280',
602 'format': 'best[protocol=https]',
603 'videopassword': 'youtube-dl',
605 'expected_warnings': ['Failed to parse XML: not well-formed'],
608 'url': 'http://vimeo.com/moogaloop.swf?clip_id=2539741',
609 'only_matching': True,
612 'url': 'https://vimeo.com/109815029',
613 'note': 'Video not completely processed, "failed" seed status',
614 'only_matching': True,
617 'url': 'https://vimeo.com/groups/travelhd/videos/22439234',
618 'only_matching': True,
621 'url': 'https://vimeo.com/album/2632481/video/79010983',
622 'only_matching': True,
625 'url': 'https://vimeo.com/showcase/3253534/video/119195465',
626 'note': 'A video in a password protected album (showcase)',
630 'title': "youtube-dl test video '' ä↭𝕐-BaW jenozKc",
631 'uploader': 'Philipp Hagemeister',
632 'uploader_id': 'user20132939',
633 'description': str, # FIXME: Dynamic SEO spam description
634 'upload_date': '20150209',
635 'timestamp': 1423518307,
636 'thumbnail': 'https://i.vimeocdn.com/video/default_1280',
639 'uploader_url': 'https://vimeo.com/user20132939',
641 'comment_count': int,
644 'format': 'best[protocol=https]',
645 'videopassword': 'youtube-dl',
647 'expected_warnings': ['Failed to parse XML: not well-formed'],
650 # source file returns 403: Forbidden
651 'url': 'https://vimeo.com/7809605',
652 'only_matching': True,
655 'note': 'Direct URL with hash',
656 'url': 'https://vimeo.com/160743502/abd0e13fb4',
660 'uploader': 'Julian Tryba',
661 'uploader_id': 'aliniamedia',
662 'title': 'Harrisville New Hampshire',
663 'timestamp': 1459259666,
664 'upload_date': '20160329',
665 'release_timestamp': 1459259666,
668 'comment_count': int,
669 'thumbnail': 'https://i.vimeocdn.com/video/562802436-585eeb13b5020c6ac0f171a2234067938098f84737787df05ff0d767f6d54ee9-d_1280',
671 'uploader_url': 'https://vimeo.com/aliniamedia',
672 'release_date': '20160329',
674 'params': {'skip_download': True},
675 'expected_warnings': ['Failed to parse XML: not well-formed'],
678 'url': 'https://vimeo.com/138909882',
683 'title': 'Eastnor Castle 2015 Firework Champions - The Promo!',
684 'description': 'md5:5967e090768a831488f6e74b7821b3c1',
685 'uploader_id': 'fireworkchampions',
686 'uploader': 'Firework Champions',
687 'upload_date': '20150910',
688 'timestamp': 1441901895,
689 'thumbnail': 'https://i.vimeocdn.com/video/534715882-6ff8e4660cbf2fea68282876d8d44f318825dfe572cc4016e73b3266eac8ae3a-d_1280',
690 'uploader_url': 'https://vimeo.com/fireworkchampions',
695 'comment_count': int,
698 'skip_download': True,
699 # 'format': 'source',
701 'expected_warnings': ['Failed to parse XML: not well-formed'],
704 'url': 'https://vimeo.com/channels/staffpicks/143603739',
708 'uploader': 'Karim Huu Do',
709 'timestamp': 1445846953,
710 'upload_date': '20151026',
711 'title': 'The Shoes - Submarine Feat. Blaine Harrison',
712 'uploader_id': 'karimhd',
713 'description': 'md5:8e2eea76de4504c2e8020a9bcfa1e843',
714 'channel_id': 'staffpicks',
716 'comment_count': int,
718 'thumbnail': 'https://i.vimeocdn.com/video/541243181-b593db36a16db2f0096f655da3f5a4dc46b8766d77b0f440df937ecb0c418347-d_1280',
720 'uploader_url': 'https://vimeo.com/karimhd',
721 'channel_url': 'https://vimeo.com/channels/staffpicks',
724 'params': {'skip_download': 'm3u8'},
725 'expected_warnings': ['Failed to parse XML: not well-formed'],
728 # requires passing unlisted_hash(a52724358e) to load_download_config request
729 'url': 'https://vimeo.com/392479337/a52724358e',
730 'only_matching': True,
733 # similar, but all numeric: ID must be 581039021, not 9603038895
735 'url': 'https://vimeo.com/581039021/9603038895',
739 'timestamp': 1627621014,
740 'release_timestamp': 1627621014,
742 'comment_count': int,
743 'thumbnail': 'https://i.vimeocdn.com/video/1202249320-4ddb2c30398c0dc0ee059172d1bd5ea481ad12f0e0e3ad01d2266f56c744b015-d_1280',
745 'uploader_url': 'https://vimeo.com/txwestcapital',
746 'release_date': '20210730',
747 'uploader': 'Christopher Inks',
748 'title': 'Thursday, July 29, 2021 BMA Evening Video Update',
749 'uploader_id': 'txwestcapital',
750 'upload_date': '20210730',
753 'skip_download': True,
755 'expected_warnings': ['Failed to parse XML: not well-formed'],
758 # chapters must be sorted, see: https://github.com/yt-dlp/yt-dlp/issues/5308
759 'url': 'https://player.vimeo.com/video/756714419',
763 'title': 'Dr Arielle Schwartz - Therapeutic yoga for optimum sleep',
764 'uploader': 'Alex Howard',
765 'uploader_id': 'user54729178',
766 'uploader_url': 'https://vimeo.com/user54729178',
767 'thumbnail': r
're:https://i\.vimeocdn\.com/video/1520099929-[\da-f]+-d_1280',
770 {'start_time': 0, 'end_time': 10, 'title': '<Untitled Chapter 1>'},
771 {'start_time': 10, 'end_time': 106, 'title': 'Welcoming Dr Arielle Schwartz'},
772 {'start_time': 106, 'end_time': 305, 'title': 'What is therapeutic yoga?'},
773 {'start_time': 305, 'end_time': 594, 'title': 'Vagal toning practices'},
774 {'start_time': 594, 'end_time': 888, 'title': 'Trauma and difficulty letting go'},
775 {'start_time': 888, 'end_time': 1059, 'title': "Dr Schwartz' insomnia experience"},
776 {'start_time': 1059, 'end_time': 1471, 'title': 'A strategy for helping sleep issues'},
777 {'start_time': 1471, 'end_time': 1667, 'title': 'Yoga nidra'},
778 {'start_time': 1667, 'end_time': 2121, 'title': 'Wisdom in stillness'},
779 {'start_time': 2121, 'end_time': 2386, 'title': 'What helps us be more able to let go?'},
780 {'start_time': 2386, 'end_time': 2510, 'title': 'Practical tips to help ourselves'},
781 {'start_time': 2510, 'end_time': 2636, 'title': 'Where to find out more'},
785 'http_headers': {'Referer': 'https://sleepsuperconference.com'},
786 'skip_download': 'm3u8',
788 'expected_warnings': ['Failed to parse XML: not well-formed'],
791 # vimeo.com URL with unlisted hash and Original format
792 'url': 'https://vimeo.com/144579403/ec02229140',
793 # 'md5': '6b662c2884e0373183fbde2a0d15cb78',
797 'title': 'SALESMANSHIP',
798 'description': 'md5:4338302f347a1ff8841b4a3aecaa09f0',
799 'uploader': 'Off the Picture Pictures',
800 'uploader_id': 'offthepicturepictures',
801 'uploader_url': 'https://vimeo.com/offthepicturepictures',
803 'upload_date': '20151104',
804 'timestamp': 1446607180,
805 'release_date': '20151104',
806 'release_timestamp': 1446607180,
809 'comment_count': int,
810 'thumbnail': r
're:https://i\.vimeocdn\.com/video/1018638656-[\da-f]+-d_1280',
812 # 'params': {'format': 'Original'},
813 'expected_warnings': ['Failed to parse XML: not well-formed'],
816 # player.vimeo.com URL with source format
817 'url': 'https://player.vimeo.com/video/859028877',
818 # 'md5': '19ca3d2463441dee2d2f0671ac2916a2',
822 'title': 'Ariana Grande - Honeymoon Avenue (Live from London)',
823 'uploader': 'Raja Virdi',
824 'uploader_id': 'rajavirdi',
825 'uploader_url': 'https://vimeo.com/rajavirdi',
827 'thumbnail': r
're:https://i\.vimeocdn\.com/video/1716727772-[\da-f]+-d_1280',
829 # 'params': {'format': 'source'},
830 'expected_warnings': ['Failed to parse XML: not well-formed'],
833 # user playlist alias -> https://vimeo.com/258705797
834 'url': 'https://vimeo.com/user26785108/newspiritualguide',
835 'only_matching': True,
837 # https://gettingthingsdone.com/workflowmap/
838 # vimeo embed with check-password page protected by Referer header
842 def _extract_embed_urls(cls
, url
, webpage
):
843 for embed_url
in super()._extract
_embed
_urls
(url
, webpage
):
844 yield cls
._smuggle
_referrer
(embed_url
, url
)
847 def _extract_url(cls
, url
, webpage
):
848 return next(cls
._extract
_embed
_urls
(url
, webpage
), None)
850 def _verify_player_video_password(self
, url
, video_id
, headers
):
851 password
= self
._get
_video
_password
()
852 data
= urlencode_postdata({
853 'password': base64
.b64encode(password
.encode()),
855 headers
= merge_dicts(headers
, {
856 'Content-Type': 'application/x-www-form-urlencoded',
858 checked
= self
._download
_json
(
859 f
'{urllib.parse.urlsplit(url)._replace(query=None).geturl()}/check-password',
860 video_id
, 'Verifying the password', data
=data
, headers
=headers
)
862 raise ExtractorError('Wrong video password', expected
=True)
865 def _extract_from_api(self
, video_id
, unlisted_hash
=None):
866 viewer
= self
._download
_json
(
867 'https://vimeo.com/_next/viewer', video_id
, 'Downloading viewer info')
869 for retry
in (False, True):
871 video
= self
._call
_videos
_api
(video_id
, viewer
['jwt'], unlisted_hash
)
873 except ExtractorError
as e
:
874 if (not retry
and isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 400
875 and 'password' in traverse_obj(
876 self
._webpage
_read
_content
(e
.cause
.response
, e
.cause
.response
.url
, video_id
, fatal
=False),
877 ({json
.loads
}, 'invalid_parameters', ..., 'field'),
879 self
._verify
_video
_password
(
880 video_id
, self
._get
_video
_password
(), viewer
['xsrft'])
884 info
= self
._parse
_config
(self
._download
_json
(
885 video
['config_url'], video_id
), video_id
)
886 source_format
= self
._extract
_original
_format
(
887 f
'https://vimeo.com/{video_id}', video_id
, unlisted_hash
, jwt
=viewer
['jwt'], api_data
=video
)
889 info
['formats'].append(source_format
)
891 get_timestamp
= lambda x
: parse_iso8601(video
.get(x
+ '_time'))
893 'description': video
.get('description'),
894 'license': video
.get('license'),
895 'release_timestamp': get_timestamp('release'),
896 'timestamp': get_timestamp('created'),
897 'view_count': int_or_none(try_get(video
, lambda x
: x
['stats']['plays'])),
899 connections
= try_get(
900 video
, lambda x
: x
['metadata']['connections'], dict) or {}
901 for k
in ('comment', 'like'):
902 info
[k
+ '_count'] = int_or_none(try_get(connections
, lambda x
: x
[k
+ 's']['total']))
905 def _try_album_password(self
, url
):
906 album_id
= self
._search
_regex
(
907 r
'vimeo\.com/(?:album|showcase)/([^/]+)', url
, 'album id', default
=None)
910 viewer
= self
._download
_json
(
911 'https://vimeo.com/_rv/viewer', album_id
, fatal
=False)
913 webpage
= self
._download
_webpage
(url
, album_id
)
914 viewer
= self
._parse
_json
(self
._search
_regex
(
915 r
'bootstrap_data\s*=\s*({.+?})</script>',
916 webpage
, 'bootstrap data'), album_id
)['viewer']
918 album
= self
._download
_json
(
919 'https://api.vimeo.com/albums/' + album_id
,
920 album_id
, headers
={'Authorization': 'jwt ' + jwt
, 'Accept': 'application/json'},
921 query
={'fields': 'description,name,privacy'})
922 if try_get(album
, lambda x
: x
['privacy']['view']) == 'password':
923 password
= self
.get_param('videopassword')
925 raise ExtractorError(
926 'This album is protected by a password, use the --video-password option',
928 self
._set
_vimeo
_cookie
('vuid', viewer
['vuid'])
931 f
'https://vimeo.com/showcase/{album_id}/auth',
932 album_id
, 'Verifying the password', data
=urlencode_postdata({
933 'password': password
,
934 'token': viewer
['xsrft'],
936 'X-Requested-With': 'XMLHttpRequest',
938 except ExtractorError
as e
:
939 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 401:
940 raise ExtractorError('Wrong password', expected
=True)
943 def _real_extract(self
, url
):
944 url
, data
, headers
= self
._unsmuggle
_headers
(url
)
945 if 'Referer' not in headers
:
946 headers
['Referer'] = url
948 # Extract ID from URL
949 mobj
= self
._match
_valid
_url
(url
).groupdict()
950 video_id
, unlisted_hash
= mobj
['id'], mobj
.get('unlisted_hash')
952 return self
._extract
_from
_api
(video_id
, unlisted_hash
)
954 if any(p
in url
for p
in ('play_redirect_hls', 'moogaloop.swf')):
955 url
= 'https://vimeo.com/' + video_id
957 self
._try
_album
_password
(url
)
958 is_secure
= urllib
.parse
.urlparse(url
).scheme
== 'https'
960 # Retrieve video webpage to extract further information
961 webpage
, urlh
= self
._download
_webpage
_handle
(
962 url
, video_id
, headers
=headers
, impersonate
=is_secure
)
963 redirect_url
= urlh
.url
964 except ExtractorError
as error
:
965 if not isinstance(error
.cause
, HTTPError
) or error
.cause
.status
not in (403, 429):
967 errmsg
= error
.cause
.response
.read()
968 if b
'Because of its privacy settings, this video cannot be played here' in errmsg
:
969 raise ExtractorError(
970 'Cannot download embed-only video without embedding URL. Please call yt-dlp '
971 'with the URL of the page that embeds this video.', expected
=True)
972 # 403 == vimeo.com TLS fingerprint or DC IP block; 429 == player.vimeo.com TLS FP block
973 status
= error
.cause
.status
974 dcip_msg
= 'If you are using a data center IP or VPN/proxy, your IP may be blocked'
975 if target
:= error
.cause
.response
.extensions
.get('impersonate'):
976 raise ExtractorError(
977 f
'Got HTTP Error {status} when using impersonate target "{target}". {dcip_msg}')
979 raise ExtractorError(f
'Got HTTP Error {status}. {dcip_msg}', expected
=True)
980 raise ExtractorError(
981 'This request has been blocked due to its TLS fingerprint. Install a '
982 'required impersonation dependency if possible, or else if you are okay with '
983 f
'{self._downloader._format_err("compromising your security/cookies", "light red")}, '
984 f
'try replacing "https:" with "http:" in the input URL. {dcip_msg}.', expected
=True)
986 if '://player.vimeo.com/video/' in url
:
987 config
= self
._search
_json
(
988 r
'\b(?:playerC|c)onfig\s*=', webpage
, 'info section', video_id
)
989 if config
.get('view') == 4:
990 config
= self
._verify
_player
_video
_password
(
991 redirect_url
, video_id
, headers
)
992 info
= self
._parse
_config
(config
, video_id
)
993 source_format
= self
._extract
_original
_format
(
994 f
'https://vimeo.com/{video_id}', video_id
, unlisted_hash
)
996 info
['formats'].append(source_format
)
999 vimeo_config
= self
._extract
_vimeo
_config
(webpage
, video_id
, default
=None)
1001 seed_status
= vimeo_config
.get('seed_status') or {}
1002 if seed_status
.get('state') == 'failed':
1003 raise ExtractorError(
1004 '{} said: {}'.format(self
.IE_NAME
, seed_status
['title']),
1009 video_description
= None
1013 channel_id
= self
._search
_regex
(
1014 r
'vimeo\.com/channels/([^/]+)', url
, 'channel id', default
=None)
1016 config_url
= self
._html
_search
_regex
(
1017 r
'\bdata-config-url="([^"]+)"', webpage
, 'config URL', default
=None)
1018 video_description
= clean_html(get_element_by_class('description', webpage
))
1020 'channel_id': channel_id
,
1021 'channel_url': 'https://vimeo.com/channels/' + channel_id
,
1024 page_config
= self
._parse
_json
(self
._search
_regex
(
1025 r
'vimeo\.(?:clip|vod_title)_page_config\s*=\s*({.+?});',
1026 webpage
, 'page config', default
='{}'), video_id
, fatal
=False)
1028 return self
._extract
_from
_api
(video_id
)
1029 config_url
= page_config
['player']['config_url']
1030 cc_license
= page_config
.get('cc_license')
1031 clip
= page_config
.get('clip') or {}
1032 timestamp
= clip
.get('uploaded_on')
1033 video_description
= clean_html(
1034 clip
.get('description') or page_config
.get('description_html_escaped'))
1035 config
= self
._download
_json
(config_url
, video_id
)
1036 video
= config
.get('video') or {}
1037 vod
= video
.get('vod') or {}
1040 if '>You rented this title.<' in webpage
:
1042 if try_get(config
, lambda x
: x
['user']['purchased']):
1044 for purchase_option
in (vod
.get('purchase_options') or []):
1045 if purchase_option
.get('purchased'):
1047 label
= purchase_option
.get('label_string')
1048 if label
and (label
.startswith('You rented this') or label
.endswith(' remaining')):
1052 if is_rented() and vod
.get('is_trailer'):
1053 feature_id
= vod
.get('feature_id')
1054 if feature_id
and not data
.get('force_feature_id', False):
1055 return self
.url_result(smuggle_url(
1056 f
'https://player.vimeo.com/player/{feature_id}',
1057 {'force_feature_id': True}), 'Vimeo')
1059 if not video_description
:
1060 video_description
= self
._html
_search
_regex
(
1061 r
'(?s)<div\s+class="[^"]*description[^"]*"[^>]*>(.*?)</div>',
1062 webpage
, 'description', default
=None)
1063 if not video_description
:
1064 video_description
= self
._html
_search
_meta
(
1065 ['description', 'og:description', 'twitter:description'],
1066 webpage
, default
=None)
1067 if not video_description
:
1068 self
.report_warning('Cannot find video description')
1071 timestamp
= self
._search
_regex
(
1072 r
'<time[^>]+datetime="([^"]+)"', webpage
,
1073 'timestamp', default
=None)
1075 view_count
= int_or_none(self
._search
_regex
(r
'UserPlays:(\d+)', webpage
, 'view count', default
=None))
1076 like_count
= int_or_none(self
._search
_regex
(r
'UserLikes:(\d+)', webpage
, 'like count', default
=None))
1077 comment_count
= int_or_none(self
._search
_regex
(r
'UserComments:(\d+)', webpage
, 'comment count', default
=None))
1081 source_format
= self
._extract
_original
_format
(
1082 'https://vimeo.com/' + video_id
, video_id
, video
.get('unlisted_hash'))
1084 formats
.append(source_format
)
1086 info_dict_config
= self
._parse
_config
(config
, video_id
)
1087 formats
.extend(info_dict_config
['formats'])
1088 info_dict
['_format_sort_fields'] = info_dict_config
['_format_sort_fields']
1090 json_ld
= self
._search
_json
_ld
(webpage
, video_id
, default
={})
1093 cc_license
= self
._search
_regex
(
1094 r
'<link[^>]+rel=["\']license
["\'][^>]+href=(["\'])(?P
<license
>(?
:(?
!\
1).)+)\
1',
1095 webpage, 'license
', default=None, group='license
')
1099 'timestamp
': unified_timestamp(timestamp),
1100 'description
': video_description,
1102 'view_count
': view_count,
1103 'like_count
': like_count,
1104 'comment_count
': comment_count,
1105 'license
': cc_license,
1108 return merge_dicts(info_dict, info_dict_config, json_ld)
1111 class VimeoOndemandIE(VimeoIE): # XXX: Do not subclass from concrete IE
1112 IE_NAME = 'vimeo
:ondemand
'
1113 _VALID_URL = r'https?
://(?
:www\
.)?vimeo\
.com
/ondemand
/(?
:[^
/]+/)?
(?P
<id>[^
/?
#&]+)'
1115 # ondemand video not available via https://vimeo.com/id
1116 'url': 'https://vimeo.com/ondemand/20704',
1117 'md5': 'c424deda8c7f73c1dfb3edd7630e2f35',
1121 'title': 'המעבדה - במאי יותם פלדמן',
1122 'uploader': 'גם סרטים',
1123 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/gumfilms',
1124 'uploader_id': 'gumfilms',
1125 'description': 'md5:aeeba3dbd4d04b0fa98a4fdc9c639998',
1126 'upload_date': '20140906',
1127 'timestamp': 1410032453,
1128 'thumbnail': 'https://i.vimeocdn.com/video/488238335-d7bf151c364cff8d467f1b73784668fe60aae28a54573a35d53a1210ae283bd8-d_1280',
1129 'comment_count': int,
1130 'license': 'https://creativecommons.org/licenses/by-nc-nd/3.0/',
1136 'format': 'best[protocol=https]',
1138 'expected_warnings': ['Unable to download JSON metadata'],
1140 # requires Referer to be passed along with og:video:url
1141 'url': 'https://vimeo.com/ondemand/36938/126682985',
1145 'title': 'Rävlock, rätt läte på rätt plats',
1146 'uploader': 'Lindroth & Norin',
1147 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/lindrothnorin',
1148 'uploader_id': 'lindrothnorin',
1149 'description': 'md5:c3c46a90529612c8279fb6af803fc0df',
1150 'upload_date': '20150502',
1151 'timestamp': 1430586422,
1153 'comment_count': int,
1155 'thumbnail': 'https://i.vimeocdn.com/video/517077723-7066ae1d9a79d3eb361334fb5d58ec13c8f04b52f8dd5eadfbd6fb0bcf11f613-d_1280',
1159 'skip_download': True,
1161 'expected_warnings': ['Unable to download JSON metadata'],
1163 'url': 'https://vimeo.com/ondemand/nazmaalik',
1164 'only_matching': True,
1166 'url': 'https://vimeo.com/ondemand/141692381',
1167 'only_matching': True,
1169 'url': 'https://vimeo.com/ondemand/thelastcolony/150274832',
1170 'only_matching': True,
1174 class VimeoChannelIE(VimeoBaseInfoExtractor
):
1175 IE_NAME
= 'vimeo:channel'
1176 _VALID_URL
= r
'https://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
1177 _MORE_PAGES_INDICATOR
= r
'<a.+?rel="next"'
1179 _TITLE_RE
= r
'<link rel="alternate"[^>]+?title="(.*?)"'
1181 'url': 'https://vimeo.com/channels/tributes',
1184 'title': 'Vimeo Tributes',
1186 'playlist_mincount': 22,
1188 _BASE_URL_TEMPL
= 'https://vimeo.com/channels/%s'
1190 def _page_url(self
, base_url
, pagenum
):
1191 return f
'{base_url}/videos/page:{pagenum}/'
1193 def _extract_list_title(self
, webpage
):
1194 return self
._TITLE
or self
._html
_search
_regex
(
1195 self
._TITLE
_RE
, webpage
, 'list title', fatal
=False)
1197 def _title_and_entries(self
, list_id
, base_url
):
1198 for pagenum
in itertools
.count(1):
1199 page_url
= self
._page
_url
(base_url
, pagenum
)
1200 webpage
= self
._download
_webpage
(
1202 f
'Downloading page {pagenum}')
1205 yield self
._extract
_list
_title
(webpage
)
1207 # Try extracting href first since not all videos are available via
1208 # short https://vimeo.com/id URL (e.g. https://vimeo.com/channels/tributes/6213729)
1210 r
'id="clip_(\d+)"[^>]*>\s*<a[^>]+href="(/(?:[^/]+/)*\1)(?:[^>]+\btitle="([^"]+)")?', webpage
)
1212 for video_id
, video_url
, video_title
in clips
:
1213 yield self
.url_result(
1214 urllib
.parse
.urljoin(base_url
, video_url
),
1215 VimeoIE
.ie_key(), video_id
=video_id
, video_title
=video_title
)
1216 # More relaxed fallback
1218 for video_id
in re
.findall(r
'id=["\']clip_(\d
+)', webpage):
1219 yield self.url_result(
1220 f'https
://vimeo
.com
/{video_id}
',
1221 VimeoIE.ie_key(), video_id=video_id)
1223 if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
1226 def _extract_videos(self, list_id, base_url):
1227 title_and_entries = self._title_and_entries(list_id, base_url)
1228 list_title = next(title_and_entries)
1229 return self.playlist_result(title_and_entries, list_id, list_title)
1231 def _real_extract(self, url):
1232 channel_id = self._match_id(url)
1233 return self._extract_videos(channel_id, self._BASE_URL_TEMPL % channel_id)
1236 class VimeoUserIE(VimeoChannelIE): # XXX: Do not subclass from concrete IE
1237 IE_NAME = 'vimeo
:user
'
1238 _VALID_URL = r'https
://vimeo\
.com
/(?
!(?
:[0-9]+|watchlater
)(?
:$|
[?
#/]))(?P<id>[^/]+)(?:/videos)?/?(?:$|[?#])'
1239 _TITLE_RE
= r
'<a[^>]+?class="user">([^<>]+?)</a>'
1241 'url': 'https://vimeo.com/nkistudio/videos',
1246 'playlist_mincount': 66,
1248 'url': 'https://vimeo.com/nkistudio/',
1249 'only_matching': True,
1251 _BASE_URL_TEMPL
= 'https://vimeo.com/%s'
1254 class VimeoAlbumIE(VimeoBaseInfoExtractor
):
1255 IE_NAME
= 'vimeo:album'
1256 _VALID_URL
= r
'https://vimeo\.com/(?:album|showcase)/(?P<id>\d+)(?:$|[?#]|/(?!video))'
1257 _TITLE_RE
= r
'<header id="page_header">\n\s*<h1>(.*?)</h1>'
1259 'url': 'https://vimeo.com/album/2632481',
1262 'title': 'Staff Favorites: November 2013',
1264 'playlist_mincount': 13,
1266 'note': 'Password-protected album',
1267 'url': 'https://vimeo.com/album/3253534',
1272 'playlist_count': 1,
1274 'videopassword': 'youtube-dl',
1279 def _fetch_page(self
, album_id
, authorization
, hashed_pass
, page
):
1282 'fields': 'link,uri',
1284 'per_page': self
._PAGE
_SIZE
,
1287 query
['_hashed_pass'] = hashed_pass
1289 videos
= self
._download
_json
(
1290 f
'https://api.vimeo.com/albums/{album_id}/videos',
1291 album_id
, f
'Downloading page {api_page}', query
=query
, headers
={
1292 'Authorization': 'jwt ' + authorization
,
1293 'Accept': 'application/json',
1295 except ExtractorError
as e
:
1296 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 400:
1299 for video
in videos
:
1300 link
= video
.get('link')
1303 uri
= video
.get('uri')
1304 video_id
= self
._search
_regex
(r
'/videos/(\d+)', uri
, 'video_id', default
=None) if uri
else None
1305 yield self
.url_result(link
, VimeoIE
.ie_key(), video_id
)
1307 def _real_extract(self
, url
):
1308 album_id
= self
._match
_id
(url
)
1309 viewer
= self
._download
_json
(
1310 'https://vimeo.com/_rv/viewer', album_id
, fatal
=False)
1312 webpage
= self
._download
_webpage
(url
, album_id
)
1313 viewer
= self
._parse
_json
(self
._search
_regex
(
1314 r
'bootstrap_data\s*=\s*({.+?})</script>',
1315 webpage
, 'bootstrap data'), album_id
)['viewer']
1317 album
= self
._download
_json
(
1318 'https://api.vimeo.com/albums/' + album_id
,
1319 album_id
, headers
={'Authorization': 'jwt ' + jwt
, 'Accept': 'application/json'},
1320 query
={'fields': 'description,name,privacy'})
1322 if try_get(album
, lambda x
: x
['privacy']['view']) == 'password':
1323 password
= self
.get_param('videopassword')
1325 raise ExtractorError(
1326 'This album is protected by a password, use the --video-password option',
1328 self
._set
_vimeo
_cookie
('vuid', viewer
['vuid'])
1330 hashed_pass
= self
._download
_json
(
1331 f
'https://vimeo.com/showcase/{album_id}/auth',
1332 album_id
, 'Verifying the password', data
=urlencode_postdata({
1333 'password': password
,
1334 'token': viewer
['xsrft'],
1336 'X-Requested-With': 'XMLHttpRequest',
1338 except ExtractorError
as e
:
1339 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 401:
1340 raise ExtractorError('Wrong password', expected
=True)
1342 entries
= OnDemandPagedList(functools
.partial(
1343 self
._fetch
_page
, album_id
, jwt
, hashed_pass
), self
._PAGE
_SIZE
)
1344 return self
.playlist_result(
1345 entries
, album_id
, album
.get('name'), album
.get('description'))
1348 class VimeoGroupsIE(VimeoChannelIE
): # XXX: Do not subclass from concrete IE
1349 IE_NAME
= 'vimeo:group'
1350 _VALID_URL
= r
'https://vimeo\.com/groups/(?P<id>[^/]+)(?:/(?!videos?/\d+)|$)'
1352 'url': 'https://vimeo.com/groups/meetup',
1355 'title': 'Vimeo Meetup!',
1357 'playlist_mincount': 27,
1359 _BASE_URL_TEMPL
= 'https://vimeo.com/groups/%s'
1362 class VimeoReviewIE(VimeoBaseInfoExtractor
):
1363 IE_NAME
= 'vimeo:review'
1364 IE_DESC
= 'Review pages on vimeo'
1365 _VALID_URL
= r
'https?://vimeo\.com/(?P<user>[^/?#]+)/review/(?P<id>\d+)/(?P<hash>[\da-f]{10})'
1367 'url': 'https://vimeo.com/user170863801/review/996447483/a316d6ed8d',
1371 'title': 'Rodeo day 1-_2',
1372 'uploader': 'BROADKAST',
1373 'uploader_id': 'user170863801',
1374 'uploader_url': 'https://vimeo.com/user170863801',
1376 'thumbnail': 'https://i.vimeocdn.com/video/1912612821-09a43bd2e75c203d503aed89de7534f28fc4474a48f59c51999716931a246af5-d_1280',
1378 'params': {'skip_download': 'm3u8'},
1379 'expected_warnings': ['Failed to parse XML'],
1381 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
1382 'md5': 'c507a72f780cacc12b2248bb4006d253',
1386 'title': "DICK HARDWICK 'Comedian'",
1387 'uploader': 'Richard Hardwick',
1388 'uploader_id': 'user21297594',
1389 'description': "Comedian Dick Hardwick's five minute demo filmed in front of a live theater audience.\nEdit by Doug Mattocks",
1391 'thumbnail': 'https://i.vimeocdn.com/video/450115033-43303819d9ebe24c2630352e18b7056d25197d09b3ae901abdac4c4f1d68de71-d_1280',
1392 'uploader_url': 'https://vimeo.com/user21297594',
1394 'skip': '404 Not Found',
1396 'note': 'video player needs Referer',
1397 'url': 'https://vimeo.com/user22258446/review/91613211/13f927e053',
1398 'md5': '6295fdab8f4bf6a002d058b2c6dce276',
1402 'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn',
1403 'uploader': 'DevWeek Events',
1405 'thumbnail': r
're:^https?://.*\.jpg$',
1406 'uploader_id': 'user22258446',
1408 'skip': 'video gone',
1410 'note': 'Password protected',
1411 'url': 'https://vimeo.com/user37284429/review/138823582/c4d865efde',
1415 'title': 'EFFICIENT PICKUP MASTERCLASS MODULE 1',
1417 'uploader_id': 'user37284429',
1420 'videopassword': 'holygrail',
1422 'skip': 'video gone',
1425 def _real_extract(self
, url
):
1426 user
, video_id
, review_hash
= self
._match
_valid
_url
(url
).group('user', 'id', 'hash')
1427 data_url
= f
'https://vimeo.com/{user}/review/data/{video_id}/{review_hash}'
1428 data
= self
._download
_json
(data_url
, video_id
)
1430 if data
.get('isLocked') is True:
1431 video_password
= self
._get
_video
_password
()
1432 viewer
= self
._download
_json
(
1433 'https://vimeo.com/_rv/viewer', video_id
)
1434 self
._verify
_video
_password
(video_id
, video_password
, viewer
['xsrft'])
1435 data
= self
._download
_json
(data_url
, video_id
)
1436 clip_data
= data
['clipData']
1437 config_url
= clip_data
['configUrl']
1438 config
= self
._download
_json
(config_url
, video_id
)
1439 info_dict
= self
._parse
_config
(config
, video_id
)
1440 source_format
= self
._extract
_original
_format
(
1441 f
'https://vimeo.com/{user}/review/{video_id}/{review_hash}/action',
1442 video_id
, unlisted_hash
=clip_data
.get('unlistedHash'), jwt
=viewer
.get('jwt'))
1444 info_dict
['formats'].append(source_format
)
1445 info_dict
['description'] = clean_html(clip_data
.get('description'))
1449 class VimeoWatchLaterIE(VimeoChannelIE
): # XXX: Do not subclass from concrete IE
1450 IE_NAME
= 'vimeo:watchlater'
1451 IE_DESC
= 'Vimeo watch later list, ":vimeowatchlater" keyword (requires authentication)'
1452 _VALID_URL
= r
'https://vimeo\.com/(?:home/)?watchlater|:vimeowatchlater'
1453 _TITLE
= 'Watch Later'
1454 _LOGIN_REQUIRED
= True
1456 'url': 'https://vimeo.com/watchlater',
1457 'only_matching': True,
1460 def _page_url(self
, base_url
, pagenum
):
1461 url
= f
'{base_url}/page:{pagenum}/'
1462 request
= Request(url
)
1463 # Set the header to get a partial html page with the ids,
1464 # the normal page doesn't contain them.
1465 request
.headers
['X-Requested-With'] = 'XMLHttpRequest'
1468 def _real_extract(self
, url
):
1469 return self
._extract
_videos
('watchlater', 'https://vimeo.com/watchlater')
1472 class VimeoLikesIE(VimeoChannelIE
): # XXX: Do not subclass from concrete IE
1473 _VALID_URL
= r
'https://(?:www\.)?vimeo\.com/(?P<id>[^/]+)/likes/?(?:$|[?#]|sort:)'
1474 IE_NAME
= 'vimeo:likes'
1475 IE_DESC
= 'Vimeo user likes'
1477 'url': 'https://vimeo.com/user755559/likes/',
1478 'playlist_mincount': 293,
1481 'title': 'urza’s Likes',
1484 'url': 'https://vimeo.com/stormlapse/likes',
1485 'only_matching': True,
1488 def _page_url(self
, base_url
, pagenum
):
1489 return f
'{base_url}/page:{pagenum}/'
1491 def _real_extract(self
, url
):
1492 user_id
= self
._match
_id
(url
)
1493 return self
._extract
_videos
(user_id
, f
'https://vimeo.com/{user_id}/likes')
1496 class VHXEmbedIE(VimeoBaseInfoExtractor
):
1497 IE_NAME
= 'vhx:embed'
1498 _VALID_URL
= r
'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
1499 _EMBED_REGEX
= [r
'<iframe[^>]+src="(?P<url>https?://embed\.vhx\.tv/videos/\d+[^"]*)"']
1502 def _extract_embed_urls(cls
, url
, webpage
):
1503 for embed_url
in super()._extract
_embed
_urls
(url
, webpage
):
1504 yield cls
._smuggle
_referrer
(embed_url
, url
)
1506 def _real_extract(self
, url
):
1507 video_id
= self
._match
_id
(url
)
1508 url
, _
, headers
= self
._unsmuggle
_headers
(url
)
1509 webpage
= self
._download
_webpage
(url
, video_id
, headers
=headers
)
1510 config_url
= self
._parse
_json
(self
._search
_regex
(
1511 r
'window\.OTTData\s*=\s*({.+})', webpage
,
1512 'ott data'), video_id
, js_to_json
)['config_url']
1513 config
= self
._download
_json
(config_url
, video_id
)
1514 info
= self
._parse
_config
(config
, video_id
)
1515 info
['id'] = video_id
1519 class VimeoProIE(VimeoBaseInfoExtractor
):
1520 IE_NAME
= 'vimeo:pro'
1521 _VALID_URL
= r
'https?://(?:www\.)?vimeopro\.com/[^/?#]+/(?P<slug>[^/?#]+)(?:(?:/videos?/(?P<id>[0-9]+)))?'
1523 # Vimeo URL derived from video_id
1524 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
1525 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
1526 'note': 'Vimeo Pro video (#1197)',
1530 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/openstreetmapus',
1531 'uploader_id': 'openstreetmapus',
1532 'uploader': 'OpenStreetMap US',
1533 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
1534 'description': 'md5:2c362968038d4499f4d79f88458590c1',
1536 'upload_date': '20130610',
1537 'timestamp': 1370893156,
1539 'thumbnail': 'https://i.vimeocdn.com/video/440260469-19b0d92fca3bd84066623b53f1eb8aaa3980c6c809e2d67b6b39ab7b4a77a344-d_960',
1541 'comment_count': int,
1546 'format': 'best[protocol=https]',
1549 # password-protected VimeoPro page with Vimeo player embed
1550 'url': 'https://vimeopro.com/cadfem/simulation-conference-mechanische-systeme-in-perfektion',
1554 'title': 'Mechanische Systeme in Perfektion: Realität erfassen, Innovation treiben',
1555 'thumbnail': 'https://i.vimeocdn.com/video/1543784598-a1a750494a485e601110136b9fe11e28c2131942452b3a5d30391cb3800ca8fd-d_1280',
1556 'description': 'md5:2a9d195cd1b0f6f79827107dc88c2420',
1557 'uploader': 'CADFEM',
1558 'uploader_id': 'cadfem',
1559 'uploader_url': 'https://vimeo.com/cadfem',
1561 'chapters': 'count:10',
1564 'videopassword': 'Conference2022',
1565 'skip_download': True,
1569 def _real_extract(self
, url
):
1570 display_id
, video_id
= self
._match
_valid
_url
(url
).group('slug', 'id')
1572 display_id
= video_id
1573 webpage
= self
._download
_webpage
(url
, display_id
)
1575 password_form
= self
._search
_regex
(
1576 r
'(?is)<form[^>]+?method=["\']post
["\'][^>]*>(.+?password.+?)</form>',
1577 webpage, 'password form', default=None)
1580 webpage = self._download_webpage(url, display_id, data=urlencode_postdata({
1581 'password': self._get_video_password(),
1582 **self._hidden_inputs(password_form),
1583 }), note='Logging in with video password')
1584 except ExtractorError as e:
1585 if isinstance(e.cause, HTTPError) and e.cause.status == 418:
1586 raise ExtractorError('Wrong video password', expected=True)
1590 # even if we have video_id, some videos require player URL with portfolio_id query param
1591 # https://github.com/ytdl-org/youtube-dl/issues/20070
1592 vimeo_url = VimeoIE._extract_url(url, webpage)
1594 description = self._html_search_meta('description', webpage, default=None)
1596 vimeo_url = f'https://vimeo.com/{video_id}'
1598 raise ExtractorError(
1599 'No Vimeo embed or video ID could be found in VimeoPro page', expected=True)
1601 return self.url_result(vimeo_url, VimeoIE, video_id, url_transparent=True,
1602 description=description)