2 from __future__
import unicode_literals
9 from .common
import InfoExtractor
10 from ..compat
import (
42 class VimeoBaseInfoExtractor(InfoExtractor
):
43 _NETRC_MACHINE
= 'vimeo'
44 _LOGIN_REQUIRED
= False
45 _LOGIN_URL
= 'https://vimeo.com/log_in'
47 def _perform_login(self
, username
, password
):
48 webpage
= self
._download
_webpage
(
49 self
._LOGIN
_URL
, None, 'Downloading login page')
50 token
, vuid
= self
._extract
_xsrft
_and
_vuid
(webpage
)
58 self
._set
_vimeo
_cookie
('vuid', vuid
)
60 self
._download
_webpage
(
61 self
._LOGIN
_URL
, None, 'Logging in',
62 data
=urlencode_postdata(data
), headers
={
63 'Content-Type': 'application/x-www-form-urlencoded',
64 'Referer': self
._LOGIN
_URL
,
66 except ExtractorError
as e
:
67 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 418:
69 'Unable to log in: bad username or password',
71 raise ExtractorError('Unable to log in')
73 def _real_initialize(self
):
74 if self
._LOGIN
_REQUIRED
and not self
._get
_cookies
('https://vimeo.com').get('vuid'):
75 self
._raise
_login
_required
()
77 def _get_video_password(self
):
78 password
= self
.get_param('videopassword')
81 'This video is protected by a password, use the --video-password option',
85 def _verify_video_password(self
, url
, video_id
, password
, token
, vuid
):
86 if url
.startswith('http://'):
87 # vimeo only supports https now, but the user can give an http url
88 url
= url
.replace('http://', 'https://')
89 self
._set
_vimeo
_cookie
('vuid', vuid
)
90 return self
._download
_webpage
(
91 url
+ '/password', video_id
, 'Verifying the password',
92 'Wrong password', data
=urlencode_postdata({
96 'Content-Type': 'application/x-www-form-urlencoded',
100 def _extract_xsrft_and_vuid(self
, webpage
):
101 xsrft
= self
._search
_regex
(
102 r
'(?:(?P<q1>["\'])xsrft(?P
=q1
)\s
*:|xsrft\s
*[=:])\s
*(?P
<q
>["\'])(?P<xsrft>.+?)(?P=q)',
103 webpage, 'login token', group='xsrft')
104 vuid = self._search_regex(
105 r'["\']vuid
["\']\s*:\s*(["\'])(?P
<vuid
>.+?
)\
1',
106 webpage, 'vuid
', group='vuid
')
109 def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs):
110 vimeo_config = self._search_regex(
111 r'vimeo\
.config\s
*=\s
*(?
:({.+?}
)|_extend\
([^
,]+,\s
+({.+?}
)\
));',
112 webpage, 'vimeo config
', *args, **compat_kwargs(kwargs))
114 return self._parse_json(vimeo_config, video_id)
116 def _set_vimeo_cookie(self, name, value):
117 self._set_cookie('vimeo
.com
', name, value)
119 def _vimeo_sort_formats(self, formats):
120 # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
121 # at the same time without actual units specified.
122 self._sort_formats(formats, ('quality
', 'res
', 'fps
', 'hdr
:12', 'source
'))
124 def _parse_config(self, config, video_id):
125 video_data = config['video
']
126 video_title = video_data['title
']
127 live_event = video_data.get('live_event
') or {}
128 is_live = live_event.get('status
') == 'started
'
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
-%s' % 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 sep_pattern = r'/sep
/video
/'
151 for files_type in ('hls
', 'dash
'):
152 for cdn_name, cdn_data in (try_get(config_files, lambda x: x[files_type]['cdns
']) or {}).items():
153 manifest_url = cdn_data.get('url
')
156 format_id = '%s-%s' % (files_type, cdn_name)
157 sep_manifest_urls = []
158 if re.search(sep_pattern, manifest_url):
159 for suffix, repl in (('', 'video
'), ('_sep
', 'sep
/video
')):
160 sep_manifest_urls.append((format_id + suffix, re.sub(
161 sep_pattern, '/%s/' % repl, manifest_url)))
163 sep_manifest_urls = [(format_id, manifest_url)]
164 for f_id, m_url in sep_manifest_urls:
165 if files_type == 'hls
':
166 fmts, subs = self._extract_m3u8_formats_and_subtitles(
167 m_url, video_id, 'mp4
', live=is_live, m3u8_id=f_id,
168 note='Downloading
%s m3u8 information
' % cdn_name,
171 self._merge_subtitles(subs, target=subtitles)
172 elif files_type == 'dash
':
173 if 'json
=1' in m_url:
174 real_m_url = (self._download_json(m_url, video_id, fatal=False) or {}).get('url
')
177 fmts, subs = self._extract_mpd_formats_and_subtitles(
178 m_url.replace('/master
.json
', '/master
.mpd
'), video_id, f_id,
179 'Downloading
%s MPD information
' % cdn_name,
182 self._merge_subtitles(subs, target=subtitles)
184 live_archive = live_event.get('archive
') or {}
185 live_archive_source_url = live_archive.get('source_url
')
186 if live_archive_source_url and live_archive.get('status
') == 'done
':
188 'format_id
': 'live
-archive
-source
',
189 'url
': live_archive_source_url,
193 for tt in (request.get('text_tracks
') or []):
194 subtitles.setdefault(tt['lang
'], []).append({
196 'url
': urljoin('https
://vimeo
.com
', tt['url
']),
201 for key, thumb in (video_data.get('thumbs
') or {}).items():
204 'width
': int_or_none(key),
207 thumbnail = video_data.get('thumbnail
')
213 owner = video_data.get('owner
') or {}
214 video_uploader_url = owner.get('url
')
216 duration = int_or_none(video_data.get('duration
'))
217 chapter_data = try_get(config, lambda x: x['embed
']['chapters
']) or []
219 'title
': current_chapter.get('title
'),
220 'start_time
': current_chapter.get('timecode
'),
221 'end_time
': next_chapter.get('timecode
'),
222 } for current_chapter, next_chapter in zip(chapter_data, chapter_data[1:] + [{'timecode': duration}])]
223 if chapters and chapters[0]['start_time
']: # Chapters may not start from 0
224 chapters[:0] = [{'title': '<Untitled>', 'start_time': 0, 'end_time': chapters[0]['start_time']}]
227 'id': str_or_none(video_data.get('id')) or video_id,
228 'title
': video_title,
229 'uploader
': owner.get('name
'),
230 'uploader_id
': video_uploader_url.split('/')[-1] if video_uploader_url else None,
231 'uploader_url
': video_uploader_url,
232 'thumbnails
': thumbnails,
233 'duration
': duration,
234 'chapters
': chapters or None,
236 'subtitles
': subtitles,
240 def _extract_original_format(self, url, video_id, unlisted_hash=None):
241 query = {'action': 'load_download_config'}
243 query['unlisted_hash
'] = unlisted_hash
244 download_data = self._download_json(
245 url, video_id, fatal=False, query=query,
246 headers={'X-Requested-With': 'XMLHttpRequest'},
247 expected_status=(403, 404)) or {}
248 source_file = download_data.get('source_file
')
249 download_url = try_get(source_file, lambda x: x['download_url
'])
250 if download_url and not source_file.get('is_cold
') and not source_file.get('is_defrosting
'):
251 source_name = source_file.get('public_name
', 'Original
')
252 if self._is_valid_url(download_url, video_id, '%s video
' % source_name):
254 source_file, lambda x: x['extension
'],
255 compat_str) or determine_ext(
256 download_url, None) or 'mp4
').lower()
260 'width
': int_or_none(source_file.get('width
')),
261 'height
': int_or_none(source_file.get('height
')),
262 'filesize
': parse_filesize(source_file.get('size
')),
263 'format_id
': source_name,
267 jwt_response = self._download_json(
268 'https
://vimeo
.com
/_rv
/viewer
', video_id, note='Downloading jwt token
', fatal=False) or {}
269 if not jwt_response.get('jwt
'):
271 headers = {'Authorization': 'jwt %s' % jwt_response['jwt']}
272 original_response = self._download_json(
273 f'https
://api
.vimeo
.com
/videos
/{video_id}
', video_id,
274 headers=headers, fatal=False, expected_status=(403, 404)) or {}
275 for download_data in original_response.get('download
') or []:
276 download_url = download_data.get('link
')
277 if not download_url or download_data.get('quality
') != 'source
':
279 ext = determine_ext(parse_qs(download_url).get('filename
', [''])[0].lower(), default_ext=None)
281 urlh = self._request_webpage(
282 HEADRequest(download_url), video_id, fatal=False, note='Determining source extension
')
283 ext = urlh and urlhandle_detect_ext(urlh)
286 'ext
': ext or 'unknown_video
',
287 'format_id
': download_data.get('public_name
', 'Original
'),
288 'width
': int_or_none(download_data.get('width
')),
289 'height
': int_or_none(download_data.get('height
')),
290 'fps
': int_or_none(download_data.get('fps
')),
291 'filesize
': int_or_none(download_data.get('size
')),
296 class VimeoIE(VimeoBaseInfoExtractor):
297 """Information extractor for vimeo.com."""
299 # _VALID_URL matches Vimeo URLs
300 _VALID_URL = r'''(?x)
310 (?!(?:channels|album|showcase)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/)
315 moogaloop\.swf)\?clip_id=
319 (?:/(?P<unlisted_hash>[\da-f]{10}))?
320 /?(?:[?&].*)?(?:[#].*)?$
325 'url
': 'http
://vimeo
.com
/56015672#at=0',
326 'md5': '8879b6cc097e987f02484baf890129e5',
330 'title': "youtube-dl test video '' ä↭𝕐-BaW jenozKc",
331 'description': 'md5:2d3305bad981a06ff79f027f19865021',
332 'timestamp': 1355990239,
333 'upload_date': '20121220',
334 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user7108434',
335 'uploader_id': 'user7108434',
336 'uploader': 'Filippo Valsorda',
341 'format': 'best[protocol=https]',
343 'skip': 'No longer available'
346 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
347 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
348 'note': 'Vimeo Pro video (#1197)',
352 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/openstreetmapus',
353 'uploader_id': 'openstreetmapus',
354 'uploader': 'OpenStreetMap US',
355 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
356 'description': 'md5:2c362968038d4499f4d79f88458590c1',
358 'upload_date': '20130610',
359 'timestamp': 1370893156,
361 'thumbnail': 'https://i.vimeocdn.com/video/440260469-19b0d92fca3bd84066623b53f1eb8aaa3980c6c809e2d67b6b39ab7b4a77a344-d_960',
363 'comment_count': int,
367 'format': 'best[protocol=https]',
371 'url': 'http://player.vimeo.com/video/54469442',
372 'md5': 'b3e7f4d2cbb53bd7dc3bb6ff4ed5cfbd',
373 'note': 'Videos that embed the url in the player page',
377 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
378 'uploader': 'Business of Software',
379 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/businessofsoftware',
380 'uploader_id': 'businessofsoftware',
383 'thumbnail': 'https://i.vimeocdn.com/video/376682406-f34043e7b766af6bef2af81366eacd6724f3fc3173179a11a97a1e26587c9529-d_1280',
386 'format': 'best[protocol=https]',
390 'url': 'http://vimeo.com/68375962',
391 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
392 'note': 'Video protected with password',
396 'title': 'youtube-dl password protected test video',
397 'timestamp': 1371200155,
398 'upload_date': '20130614',
399 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user18948128',
400 'uploader_id': 'user18948128',
401 'uploader': 'Jaime Marquínez Ferrándiz',
403 'description': 'md5:dca3ea23adb29ee387127bc4ddfce63f',
404 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_960',
406 'comment_count': int,
410 'format': 'best[protocol=https]',
411 'videopassword': 'youtube-dl',
415 'url': 'http://vimeo.com/channels/keypeele/75629013',
416 'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
420 'title': 'Key & Peele: Terrorist Interrogation',
421 'description': 'md5:8678b246399b070816b12313e8b4eb5c',
422 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/atencio',
423 'uploader_id': 'atencio',
424 'uploader': 'Peter Atencio',
425 'channel_id': 'keypeele',
426 'channel_url': r
're:https?://(?:www\.)?vimeo\.com/channels/keypeele',
427 'timestamp': 1380339469,
428 'upload_date': '20130928',
430 'thumbnail': 'https://i.vimeocdn.com/video/450239872-a05512d9b1e55d707a7c04365c10980f327b06d966351bc403a5d5d65c95e572-d_1280',
432 'comment_count': int,
435 'params': {'format': 'http-1080p'}
,
438 'url': 'http://vimeo.com/76979871',
439 'note': 'Video with subtitles',
443 'title': 'The New Vimeo Player (You Know, For Videos)',
444 'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
445 'timestamp': 1381846109,
446 'upload_date': '20131015',
447 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/staff',
448 'uploader_id': 'staff',
449 'uploader': 'Vimeo Staff',
452 'de': [{'ext': 'vtt'}
],
453 'en': [{'ext': 'vtt'}
],
454 'es': [{'ext': 'vtt'}
],
455 'fr': [{'ext': 'vtt'}
],
458 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'],
461 # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/
462 'url': 'https://player.vimeo.com/video/98044508',
463 'note': 'The js code contains assignments to the same variable as the config',
467 'title': 'Pier Solar OUYA Official Trailer',
468 'uploader': 'Tulio Gonçalves',
469 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user28849593',
470 'uploader_id': 'user28849593',
472 'thumbnail': 'https://i.vimeocdn.com/video/478636036-c18440305ef3df9decfb6bf207a61fe39d2d17fa462a96f6f2d93d30492b037d-d_1280',
476 # contains original format
477 'url': 'https://vimeo.com/33951933',
478 'md5': '53c688fa95a55bf4b7293d37a89c5c53',
482 'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute',
483 'uploader': 'The DMCI',
484 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/dmci',
485 'uploader_id': 'dmci',
486 'timestamp': 1324343742,
487 'upload_date': '20111220',
488 'description': 'md5:ae23671e82d05415868f7ad1aec21147',
490 'comment_count': int,
492 'thumbnail': 'https://i.vimeocdn.com/video/231174622-dd07f015e9221ff529d451e1cc31c982b5d87bfafa48c4189b1da72824ee289a-d_1280',
497 'note': 'Contains original format not accessible in webpage',
498 'url': 'https://vimeo.com/393756517',
499 'md5': 'c464af248b592190a5ffbb5d33f382b0',
503 'timestamp': 1582642091,
504 'uploader_id': 'frameworkla',
505 'title': 'Straight To Hell - Sabrina: Netflix',
506 'uploader': 'Framework Studio',
507 'description': 'md5:f2edc61af3ea7a5592681ddbb683db73',
508 'upload_date': '20200225',
510 'thumbnail': 'https://i.vimeocdn.com/video/859377297-836494a4ef775e9d4edbace83937d9ad34dc846c688c0c419c0e87f7ab06c4b3-d_1280',
511 'uploader_url': 'https://vimeo.com/frameworkla',
515 # only available via https://vimeo.com/channels/tributes/6213729 and
516 # not via https://vimeo.com/6213729
517 'url': 'https://vimeo.com/channels/tributes/6213729',
521 'title': 'Vimeo Tribute: The Shining',
522 'uploader': 'Casey Donahue',
523 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/caseydonahue',
524 'uploader_id': 'caseydonahue',
525 'channel_url': r
're:https?://(?:www\.)?vimeo\.com/channels/tributes',
526 'channel_id': 'tributes',
527 'timestamp': 1250886430,
528 'upload_date': '20090821',
529 'description': 'md5:bdbf314014e58713e6e5b66eb252f4a6',
531 'comment_count': int,
533 'thumbnail': 'https://i.vimeocdn.com/video/22728298-bfc22146f930de7cf497821c7b0b9f168099201ecca39b00b6bd31fcedfca7a6-d_1280',
537 'skip_download': True,
541 # redirects to ondemand extractor and should be passed through it
542 # for successful extraction
543 'url': 'https://vimeo.com/73445910',
547 'title': 'The Reluctant Revolutionary',
548 'uploader': '10Ft Films',
549 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/tenfootfilms',
550 'uploader_id': 'tenfootfilms',
551 'description': 'md5:0fa704e05b04f91f40b7f3ca2e801384',
552 'upload_date': '20130830',
553 'timestamp': 1377853339,
556 'skip_download': True,
558 'skip': 'this page is no longer available.',
561 'url': 'http://player.vimeo.com/video/68375962',
562 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
566 'title': 'youtube-dl password protected test video',
567 'timestamp': 1371200155,
568 'upload_date': '20130614',
569 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/user18948128',
570 'uploader_id': 'user18948128',
571 'uploader': 'Jaime Marquínez Ferrándiz',
573 'description': 'md5:dca3ea23adb29ee387127bc4ddfce63f',
574 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_960',
576 'comment_count': int,
580 'format': 'best[protocol=https]',
581 'videopassword': 'youtube-dl',
585 'url': 'http://vimeo.com/moogaloop.swf?clip_id=2539741',
586 'only_matching': True,
589 'url': 'https://vimeo.com/109815029',
590 'note': 'Video not completely processed, "failed" seed status',
591 'only_matching': True,
594 'url': 'https://vimeo.com/groups/travelhd/videos/22439234',
595 'only_matching': True,
598 'url': 'https://vimeo.com/album/2632481/video/79010983',
599 'only_matching': True,
602 'url': 'https://vimeo.com/showcase/3253534/video/119195465',
603 'note': 'A video in a password protected album (showcase)',
607 'title': "youtube-dl test video '' ä↭𝕐-BaW jenozKc",
608 'uploader': 'Philipp Hagemeister',
609 'uploader_id': 'user20132939',
610 'description': 'md5:fa7b6c6d8db0bdc353893df2f111855b',
611 'upload_date': '20150209',
612 'timestamp': 1423518307,
613 'thumbnail': 'https://i.vimeocdn.com/video/default_1280',
616 'uploader_url': 'https://vimeo.com/user20132939',
618 'comment_count': int,
621 'format': 'best[protocol=https]',
622 'videopassword': 'youtube-dl',
626 # source file returns 403: Forbidden
627 'url': 'https://vimeo.com/7809605',
628 'only_matching': True,
631 'note': 'Direct URL with hash',
632 'url': 'https://vimeo.com/160743502/abd0e13fb4',
636 'uploader': 'Julian Tryba',
637 'uploader_id': 'aliniamedia',
638 'title': 'Harrisville New Hampshire',
639 'timestamp': 1459259666,
640 'upload_date': '20160329',
641 'release_timestamp': 1459259666,
644 'comment_count': int,
645 'thumbnail': 'https://i.vimeocdn.com/video/562802436-585eeb13b5020c6ac0f171a2234067938098f84737787df05ff0d767f6d54ee9-d_1280',
647 'uploader_url': 'https://vimeo.com/aliniamedia',
648 'release_date': '20160329',
650 'params': {'skip_download': True}
,
653 'url': 'https://vimeo.com/138909882',
657 'title': 'Eastnor Castle 2015 Firework Champions - The Promo!',
658 'description': 'md5:5967e090768a831488f6e74b7821b3c1',
659 'uploader_id': 'fireworkchampions',
660 'uploader': 'Firework Champions',
661 'upload_date': '20150910',
662 'timestamp': 1441901895,
665 'skip_download': True,
666 'format': 'Original',
670 'url': 'https://vimeo.com/channels/staffpicks/143603739',
674 'uploader': 'Karim Huu Do',
675 'timestamp': 1445846953,
676 'upload_date': '20151026',
677 'title': 'The Shoes - Submarine Feat. Blaine Harrison',
678 'uploader_id': 'karimhd',
679 'description': 'md5:8e2eea76de4504c2e8020a9bcfa1e843',
680 'channel_id': 'staffpicks',
682 'comment_count': int,
684 'thumbnail': 'https://i.vimeocdn.com/video/541243181-b593db36a16db2f0096f655da3f5a4dc46b8766d77b0f440df937ecb0c418347-d_1280',
686 'uploader_url': 'https://vimeo.com/karimhd',
687 'channel_url': 'https://vimeo.com/channels/staffpicks',
689 'params': {'skip_download': 'm3u8'}
,
692 # requires passing unlisted_hash(a52724358e) to load_download_config request
693 'url': 'https://vimeo.com/392479337/a52724358e',
694 'only_matching': True,
697 # similar, but all numeric: ID must be 581039021, not 9603038895
699 'url': 'https://vimeo.com/581039021/9603038895',
703 'timestamp': 1627621014,
704 'release_timestamp': 1627621014,
706 'comment_count': int,
707 'thumbnail': 'https://i.vimeocdn.com/video/1202249320-4ddb2c30398c0dc0ee059172d1bd5ea481ad12f0e0e3ad01d2266f56c744b015-d_1280',
709 'uploader_url': 'https://vimeo.com/txwestcapital',
710 'release_date': '20210730',
711 'uploader': 'Christopher Inks',
712 'title': 'Thursday, July 29, 2021 BMA Evening Video Update',
713 'uploader_id': 'txwestcapital',
714 'upload_date': '20210730',
717 'skip_download': True,
720 # https://gettingthingsdone.com/workflowmap/
721 # vimeo embed with check-password page protected by Referer header
725 def _smuggle_referrer(url
, referrer_url
):
726 return smuggle_url(url
, {'http_headers': {'Referer': referrer_url}
})
729 def _extract_urls(url
, webpage
):
731 # Look for embedded (iframe) Vimeo player
732 for mobj
in re
.finditer(
733 r
'<iframe[^>]+?src=(["\'])(?P
<url
>(?
:https?
:)?
//player\
.vimeo\
.com
/video
/\d
+.*?
)\
1',
735 urls.append(VimeoIE._smuggle_referrer(unescapeHTML(mobj.group('url
')), url))
737 # Look for embedded (swf embed) Vimeo player
738 r'<embed
[^
>]+?src
=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)\1',
739 # Look more for non-standard embedded Vimeo player
740 r'<video[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//(?
:www\
.)?vimeo\
.com
/[0-9]+)\
1',
742 for embed_re in PLAIN_EMBED_RE:
743 for mobj in re.finditer(embed_re, webpage):
744 urls.append(mobj.group('url
'))
748 def _extract_url(url, webpage):
749 urls = VimeoIE._extract_urls(url, webpage)
750 return urls[0] if urls else None
752 def _verify_player_video_password(self, url, video_id, headers):
753 password = self._get_video_password()
754 data = urlencode_postdata({
755 'password
': base64.b64encode(password.encode()),
757 headers = merge_dicts(headers, {
758 'Content
-Type
': 'application
/x
-www
-form
-urlencoded
',
760 checked = self._download_json(
761 url + '/check
-password
', video_id,
762 'Verifying the password
', data=data, headers=headers)
764 raise ExtractorError('Wrong video password
', expected=True)
767 def _extract_from_api(self, video_id, unlisted_hash=None):
768 token = self._download_json(
769 'https
://vimeo
.com
/_rv
/jwt
', video_id, headers={
770 'X
-Requested
-With
': 'XMLHttpRequest
'
772 api_url = 'https
://api
.vimeo
.com
/videos
/' + video_id
774 api_url += ':' + unlisted_hash
775 video = self._download_json(
776 api_url, video_id, headers={
777 'Authorization
': 'jwt
' + token,
779 'fields
': 'config_url
,created_time
,description
,license
,metadata
.connections
.comments
.total
,metadata
.connections
.likes
.total
,release_time
,stats
.plays
',
781 info = self._parse_config(self._download_json(
782 video['config_url
'], video_id), video_id)
783 self._vimeo_sort_formats(info['formats
'])
784 get_timestamp = lambda x: parse_iso8601(video.get(x + '_time
'))
786 'description
': video.get('description
'),
787 'license
': video.get('license
'),
788 'release_timestamp
': get_timestamp('release
'),
789 'timestamp
': get_timestamp('created
'),
790 'view_count
': int_or_none(try_get(video, lambda x: x['stats
']['plays
'])),
792 connections = try_get(
793 video, lambda x: x['metadata
']['connections
'], dict) or {}
794 for k in ('comment
', 'like
'):
795 info[k + '_count
'] = int_or_none(try_get(connections, lambda x: x[k + 's
']['total
']))
798 def _try_album_password(self, url):
799 album_id = self._search_regex(
800 r'vimeo\
.com
/(?
:album|showcase
)/([^
/]+)', url, 'album
id', default=None)
803 viewer = self._download_json(
804 'https
://vimeo
.com
/_rv
/viewer
', album_id, fatal=False)
806 webpage = self._download_webpage(url, album_id)
807 viewer = self._parse_json(self._search_regex(
808 r'bootstrap_data\s
*=\s
*({.+?}
)</script
>',
809 webpage, 'bootstrap data
'), album_id)['viewer
']
811 album = self._download_json(
812 'https
://api
.vimeo
.com
/albums
/' + album_id,
813 album_id, headers={'Authorization': 'jwt ' + jwt},
814 query={'fields': 'description,name,privacy'})
815 if try_get(album, lambda x: x['privacy
']['view
']) == 'password
':
816 password = self.get_param('videopassword
')
818 raise ExtractorError(
819 'This album
is protected by a password
, use the
--video
-password option
',
821 self._set_vimeo_cookie('vuid
', viewer['vuid
'])
824 'https
://vimeo
.com
/showcase
/%s/auth
' % album_id,
825 album_id, 'Verifying the password
', data=urlencode_postdata({
826 'password
': password,
827 'token
': viewer['xsrft
'],
829 'X
-Requested
-With
': 'XMLHttpRequest
',
831 except ExtractorError as e:
832 if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401:
833 raise ExtractorError('Wrong password
', expected=True)
836 def _real_extract(self, url):
837 url, data = unsmuggle_url(url, {})
838 headers = self.get_param('http_headers
').copy()
839 if 'http_headers
' in data:
840 headers.update(data['http_headers
'])
841 if 'Referer
' not in headers:
842 headers['Referer
'] = url
844 # Extract ID from URL
845 mobj = self._match_valid_url(url).groupdict()
846 video_id, unlisted_hash = mobj['id'], mobj.get('unlisted_hash
')
848 return self._extract_from_api(video_id, unlisted_hash)
851 is_pro = 'vimeopro
.com
/' in url
853 # some videos require portfolio_id to be present in player url
854 # https://github.com/ytdl-org/youtube-dl/issues/20070
855 url = self._extract_url(url, self._download_webpage(url, video_id))
857 url = 'https
://vimeo
.com
/' + video_id
858 elif any(p in url for p in ('play_redirect_hls
', 'moogaloop
.swf
')):
859 url = 'https
://vimeo
.com
/' + video_id
861 self._try_album_password(url)
863 # Retrieve video webpage to extract further information
864 webpage, urlh = self._download_webpage_handle(
865 url, video_id, headers=headers)
866 redirect_url = urlh.geturl()
867 except ExtractorError as ee:
868 if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
869 errmsg = ee.cause.read()
870 if b'Because of its privacy settings
, this video cannot be played here
' in errmsg:
871 raise ExtractorError(
872 'Cannot download embed
-only video without embedding
'
873 'URL
. Please call yt
-dlp
with the URL of the page
'
874 'that embeds this video
.',
878 if '://player
.vimeo
.com
/video
/' in url:
879 config = self._parse_json(self._search_regex(
880 r'\bconfig\s
*=\s
*({.+?}
)\s
*;', webpage, 'info section
'), video_id)
881 if config.get('view
') == 4:
882 config = self._verify_player_video_password(
883 redirect_url, video_id, headers)
884 info = self._parse_config(config, video_id)
885 self._vimeo_sort_formats(info['formats
'])
888 if re.search(r'<form
[^
>]+?
id="pw_form"', webpage):
889 video_password = self._get_video_password()
890 token, vuid = self._extract_xsrft_and_vuid(webpage)
891 webpage = self._verify_video_password(
892 redirect_url, video_id, video_password, token, vuid)
894 vimeo_config = self._extract_vimeo_config(webpage, video_id, default=None)
896 seed_status = vimeo_config.get('seed_status
') or {}
897 if seed_status.get('state
') == 'failed
':
898 raise ExtractorError(
899 '%s said
: %s' % (self.IE_NAME, seed_status['title
']),
904 video_description = None
908 channel_id = self._search_regex(
909 r'vimeo\
.com
/channels
/([^
/]+)', url, 'channel
id', default=None)
911 config_url = self._html_search_regex(
912 r'\bdata
-config
-url
="([^"]+)"', webpage, 'config URL', default=None)
913 video_description = clean_html(get_element_by_class('description', webpage))
915 'channel_id': channel_id,
916 'channel_url': 'https://vimeo.com/channels/' + channel_id,
919 page_config = self._parse_json(self._search_regex(
920 r'vimeo\.(?:clip|vod_title)_page_config\s*=\s*({.+?});',
921 webpage, 'page config', default='{}'), video_id, fatal=False)
923 return self._extract_from_api(video_id)
924 config_url = page_config['player']['config_url']
925 cc_license = page_config.get('cc_license')
926 clip = page_config.get('clip') or {}
927 timestamp = clip.get('uploaded_on')
928 video_description = clean_html(
929 clip.get('description') or page_config.get('description_html_escaped'))
930 config = self._download_json(config_url, video_id)
931 video = config.get('video') or {}
932 vod = video.get('vod') or {}
935 if '>You rented this title.<' in webpage:
937 if try_get(config, lambda x: x['user']['purchased']):
939 for purchase_option in (vod.get('purchase_options') or []):
940 if purchase_option.get('purchased'):
942 label = purchase_option.get('label_string')
943 if label and (label.startswith('You rented this') or label.endswith(' remaining')):
947 if is_rented() and vod.get('is_trailer'):
948 feature_id = vod.get('feature_id')
949 if feature_id and not data.get('force_feature_id', False):
950 return self.url_result(smuggle_url(
951 'https://player.vimeo.com/player/%s' % feature_id,
952 {'force_feature_id': True}), 'Vimeo')
954 if not video_description:
955 video_description = self._html_search_regex(
956 r'(?s)<div\s+class="[^
"]*description[^"]*"[^>]*>(.*?)</div>',
957 webpage, 'description', default=None)
958 if not video_description:
959 video_description = self._html_search_meta(
960 ['description', 'og:description', 'twitter:description'],
961 webpage, default=None)
962 if not video_description and is_pro:
963 orig_webpage = self._download_webpage(
965 note='Downloading webpage for description',
968 video_description = self._html_search_meta(
969 'description', orig_webpage, default=None)
970 if not video_description:
971 self.report_warning('Cannot find video description')
974 timestamp = self._search_regex(
975 r'<time[^>]+datetime="([^
"]+)"', webpage,
976 'timestamp
', default=None)
978 view_count = int_or_none(self._search_regex(r'UserPlays
:(\d
+)', webpage, 'view count
', default=None))
979 like_count = int_or_none(self._search_regex(r'UserLikes
:(\d
+)', webpage, 'like count
', default=None))
980 comment_count = int_or_none(self._search_regex(r'UserComments
:(\d
+)', webpage, 'comment count
', default=None))
984 source_format = self._extract_original_format(
985 'https
://vimeo
.com
/' + video_id, video_id, video.get('unlisted_hash
'))
987 formats.append(source_format)
989 info_dict_config = self._parse_config(config, video_id)
990 formats.extend(info_dict_config['formats
'])
991 self._vimeo_sort_formats(formats)
993 json_ld = self._search_json_ld(webpage, video_id, default={})
996 cc_license = self._search_regex(
997 r'<link
[^
>]+rel
=["\']license["\'][^
>]+href
=(["\'])(?P<license>(?:(?!\1).)+)\1',
998 webpage, 'license', default=None, group='license')
1002 'timestamp': unified_timestamp(timestamp),
1003 'description': video_description,
1005 'view_count': view_count,
1006 'like_count': like_count,
1007 'comment_count': comment_count,
1008 'license': cc_license,
1011 return merge_dicts(info_dict, info_dict_config, json_ld)
1014 class VimeoOndemandIE(VimeoIE):
1015 IE_NAME = 'vimeo:ondemand'
1016 _VALID_URL = r'https?://(?:www\.)?vimeo\.com/ondemand/(?:[^/]+/)?(?P<id>[^/?#&]+)'
1018 # ondemand video not available via https://vimeo.com/id
1019 'url': 'https://vimeo.com/ondemand/20704',
1020 'md5': 'c424deda8c7f73c1dfb3edd7630e2f35',
1024 'title': 'המעבדה - במאי יותם פלדמן',
1025 'uploader': 'גם סרטים',
1026 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/gumfilms',
1027 'uploader_id': 'gumfilms',
1028 'description': 'md5:aeeba3dbd4d04b0fa98a4fdc9c639998',
1029 'upload_date': '20140906',
1030 'timestamp': 1410032453,
1031 'thumbnail': 'https://i.vimeocdn.com/video/488238335-d7bf151c364cff8d467f1b73784668fe60aae28a54573a35d53a1210ae283bd8-d_1280',
1032 'comment_count': int,
1033 'license': 'https://creativecommons.org/licenses/by-nc-nd/3.0/',
1039 'format': 'best[protocol=https]',
1041 'expected_warnings': ['Unable to download JSON metadata'],
1043 # requires Referer to be passed along with og:video:url
1044 'url': 'https://vimeo.com/ondemand/36938/126682985',
1048 'title': 'Rävlock, rätt läte på rätt plats',
1049 'uploader': 'Lindroth & Norin',
1050 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/lindrothnorin',
1051 'uploader_id': 'lindrothnorin',
1052 'description': 'md5:c3c46a90529612c8279fb6af803fc0df',
1053 'upload_date': '20150502',
1054 'timestamp': 1430586422,
1056 'comment_count': int,
1058 'thumbnail': 'https://i.vimeocdn.com/video/517077723-7066ae1d9a79d3eb361334fb5d58ec13c8f04b52f8dd5eadfbd6fb0bcf11f613-d_1280',
1062 'skip_download': True,
1064 'expected_warnings': ['Unable to download JSON metadata'],
1066 'url': 'https://vimeo.com/ondemand/nazmaalik',
1067 'only_matching': True,
1069 'url': 'https://vimeo.com/ondemand/141692381',
1070 'only_matching': True,
1072 'url': 'https://vimeo.com/ondemand/thelastcolony/150274832',
1073 'only_matching': True,
1077 class VimeoChannelIE(VimeoBaseInfoExtractor):
1078 IE_NAME = 'vimeo:channel'
1079 _VALID_URL = r'https://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
1080 _MORE_PAGES_INDICATOR = r'<a.+?rel="next
"'
1082 _TITLE_RE = r'<link rel="alternate
"[^>]+?title="(.*?
)"'
1084 'url': 'https://vimeo.com/channels/tributes',
1087 'title': 'Vimeo Tributes',
1089 'playlist_mincount': 22,
1091 _BASE_URL_TEMPL = 'https://vimeo.com/channels/%s'
1093 def _page_url(self, base_url, pagenum):
1094 return '%s/videos/page:%d/' % (base_url, pagenum)
1096 def _extract_list_title(self, webpage):
1097 return self._TITLE or self._html_search_regex(
1098 self._TITLE_RE, webpage, 'list title', fatal=False)
1100 def _title_and_entries(self, list_id, base_url):
1101 for pagenum in itertools.count(1):
1102 page_url = self._page_url(base_url, pagenum)
1103 webpage = self._download_webpage(
1105 'Downloading page %s' % pagenum)
1108 yield self._extract_list_title(webpage)
1110 # Try extracting href first since not all videos are available via
1111 # short https://vimeo.com/id URL (e.g. https://vimeo.com/channels/tributes/6213729)
1113 r'id="clip_(\d
+)"[^>]*>\s*<a[^>]+href="(/(?
:[^
/]+/)*\
1)(?
:[^
>]+\btitle
="([^"]+)")?', webpage)
1115 for video_id, video_url, video_title in clips:
1116 yield self.url_result(
1117 compat_urlparse.urljoin(base_url, video_url),
1118 VimeoIE.ie_key(), video_id=video_id, video_title=video_title)
1119 # More relaxed fallback
1121 for video_id in re.findall(r'id=["\']clip_(\d
+)', webpage):
1122 yield self.url_result(
1123 'https
://vimeo
.com
/%s' % video_id,
1124 VimeoIE.ie_key(), video_id=video_id)
1126 if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
1129 def _extract_videos(self, list_id, base_url):
1130 title_and_entries = self._title_and_entries(list_id, base_url)
1131 list_title = next(title_and_entries)
1132 return self.playlist_result(title_and_entries, list_id, list_title)
1134 def _real_extract(self, url):
1135 channel_id = self._match_id(url)
1136 return self._extract_videos(channel_id, self._BASE_URL_TEMPL % channel_id)
1139 class VimeoUserIE(VimeoChannelIE):
1140 IE_NAME = 'vimeo
:user
'
1141 _VALID_URL = r'https
://vimeo\
.com
/(?
!(?
:[0-9]+|watchlater
)(?
:$|
[?
#/]))(?P<id>[^/]+)(?:/videos|[#?]|$)'
1142 _TITLE_RE
= r
'<a[^>]+?class="user">([^<>]+?)</a>'
1144 'url': 'https://vimeo.com/nkistudio/videos',
1149 'playlist_mincount': 66,
1151 _BASE_URL_TEMPL
= 'https://vimeo.com/%s'
1154 class VimeoAlbumIE(VimeoBaseInfoExtractor
):
1155 IE_NAME
= 'vimeo:album'
1156 _VALID_URL
= r
'https://vimeo\.com/(?:album|showcase)/(?P<id>\d+)(?:$|[?#]|/(?!video))'
1157 _TITLE_RE
= r
'<header id="page_header">\n\s*<h1>(.*?)</h1>'
1159 'url': 'https://vimeo.com/album/2632481',
1162 'title': 'Staff Favorites: November 2013',
1164 'playlist_mincount': 13,
1166 'note': 'Password-protected album',
1167 'url': 'https://vimeo.com/album/3253534',
1172 'playlist_count': 1,
1174 'videopassword': 'youtube-dl',
1179 def _fetch_page(self
, album_id
, authorization
, hashed_pass
, page
):
1182 'fields': 'link,uri',
1184 'per_page': self
._PAGE
_SIZE
,
1187 query
['_hashed_pass'] = hashed_pass
1189 videos
= self
._download
_json
(
1190 'https://api.vimeo.com/albums/%s/videos' % album_id
,
1191 album_id
, 'Downloading page %d' % api_page
, query
=query
, headers
={
1192 'Authorization': 'jwt ' + authorization
,
1194 except ExtractorError
as e
:
1195 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 400:
1197 for video
in videos
:
1198 link
= video
.get('link')
1201 uri
= video
.get('uri')
1202 video_id
= self
._search
_regex
(r
'/videos/(\d+)', uri
, 'video_id', default
=None) if uri
else None
1203 yield self
.url_result(link
, VimeoIE
.ie_key(), video_id
)
1205 def _real_extract(self
, url
):
1206 album_id
= self
._match
_id
(url
)
1207 viewer
= self
._download
_json
(
1208 'https://vimeo.com/_rv/viewer', album_id
, fatal
=False)
1210 webpage
= self
._download
_webpage
(url
, album_id
)
1211 viewer
= self
._parse
_json
(self
._search
_regex
(
1212 r
'bootstrap_data\s*=\s*({.+?})</script>',
1213 webpage
, 'bootstrap data'), album_id
)['viewer']
1215 album
= self
._download
_json
(
1216 'https://api.vimeo.com/albums/' + album_id
,
1217 album_id
, headers
={'Authorization': 'jwt ' + jwt}
,
1218 query
={'fields': 'description,name,privacy'}
)
1220 if try_get(album
, lambda x
: x
['privacy']['view']) == 'password':
1221 password
= self
.get_param('videopassword')
1223 raise ExtractorError(
1224 'This album is protected by a password, use the --video-password option',
1226 self
._set
_vimeo
_cookie
('vuid', viewer
['vuid'])
1228 hashed_pass
= self
._download
_json
(
1229 'https://vimeo.com/showcase/%s/auth' % album_id
,
1230 album_id
, 'Verifying the password', data
=urlencode_postdata({
1231 'password': password
,
1232 'token': viewer
['xsrft'],
1234 'X-Requested-With': 'XMLHttpRequest',
1236 except ExtractorError
as e
:
1237 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 401:
1238 raise ExtractorError('Wrong password', expected
=True)
1240 entries
= OnDemandPagedList(functools
.partial(
1241 self
._fetch
_page
, album_id
, jwt
, hashed_pass
), self
._PAGE
_SIZE
)
1242 return self
.playlist_result(
1243 entries
, album_id
, album
.get('name'), album
.get('description'))
1246 class VimeoGroupsIE(VimeoChannelIE
):
1247 IE_NAME
= 'vimeo:group'
1248 _VALID_URL
= r
'https://vimeo\.com/groups/(?P<id>[^/]+)(?:/(?!videos?/\d+)|$)'
1250 'url': 'https://vimeo.com/groups/meetup',
1253 'title': 'Vimeo Meetup!',
1255 'playlist_mincount': 27,
1257 _BASE_URL_TEMPL
= 'https://vimeo.com/groups/%s'
1260 class VimeoReviewIE(VimeoBaseInfoExtractor
):
1261 IE_NAME
= 'vimeo:review'
1262 IE_DESC
= 'Review pages on vimeo'
1263 _VALID_URL
= r
'(?P<url>https://vimeo\.com/[^/]+/review/(?P<id>[^/]+)/[0-9a-f]{10})'
1265 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
1266 'md5': 'c507a72f780cacc12b2248bb4006d253',
1270 'title': "DICK HARDWICK 'Comedian'",
1271 'uploader': 'Richard Hardwick',
1272 'uploader_id': 'user21297594',
1273 'description': "Comedian Dick Hardwick's five minute demo filmed in front of a live theater audience.\nEdit by Doug Mattocks",
1275 'thumbnail': 'https://i.vimeocdn.com/video/450115033-43303819d9ebe24c2630352e18b7056d25197d09b3ae901abdac4c4f1d68de71-d_1280',
1276 'uploader_url': 'https://vimeo.com/user21297594',
1279 'note': 'video player needs Referer',
1280 'url': 'https://vimeo.com/user22258446/review/91613211/13f927e053',
1281 'md5': '6295fdab8f4bf6a002d058b2c6dce276',
1285 'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn',
1286 'uploader': 'DevWeek Events',
1288 'thumbnail': r
're:^https?://.*\.jpg$',
1289 'uploader_id': 'user22258446',
1291 'skip': 'video gone',
1293 'note': 'Password protected',
1294 'url': 'https://vimeo.com/user37284429/review/138823582/c4d865efde',
1298 'title': 'EFFICIENT PICKUP MASTERCLASS MODULE 1',
1300 'uploader_id': 'user37284429',
1303 'videopassword': 'holygrail',
1305 'skip': 'video gone',
1308 def _real_extract(self
, url
):
1309 page_url
, video_id
= self
._match
_valid
_url
(url
).groups()
1310 data
= self
._download
_json
(
1311 page_url
.replace('/review/', '/review/data/'), video_id
)
1312 if data
.get('isLocked') is True:
1313 video_password
= self
._get
_video
_password
()
1314 viewer
= self
._download
_json
(
1315 'https://vimeo.com/_rv/viewer', video_id
)
1316 webpage
= self
._verify
_video
_password
(
1317 'https://vimeo.com/' + video_id
, video_id
,
1318 video_password
, viewer
['xsrft'], viewer
['vuid'])
1319 clip_page_config
= self
._parse
_json
(self
._search
_regex
(
1320 r
'window\.vimeo\.clip_page_config\s*=\s*({.+?});',
1321 webpage
, 'clip page config'), video_id
)
1322 config_url
= clip_page_config
['player']['config_url']
1323 clip_data
= clip_page_config
.get('clip') or {}
1325 clip_data
= data
['clipData']
1326 config_url
= clip_data
['configUrl']
1327 config
= self
._download
_json
(config_url
, video_id
)
1328 info_dict
= self
._parse
_config
(config
, video_id
)
1329 source_format
= self
._extract
_original
_format
(
1330 page_url
+ '/action', video_id
)
1332 info_dict
['formats'].append(source_format
)
1333 self
._vimeo
_sort
_formats
(info_dict
['formats'])
1334 info_dict
['description'] = clean_html(clip_data
.get('description'))
1338 class VimeoWatchLaterIE(VimeoChannelIE
):
1339 IE_NAME
= 'vimeo:watchlater'
1340 IE_DESC
= 'Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)'
1341 _VALID_URL
= r
'https://vimeo\.com/(?:home/)?watchlater|:vimeowatchlater'
1342 _TITLE
= 'Watch Later'
1343 _LOGIN_REQUIRED
= True
1345 'url': 'https://vimeo.com/watchlater',
1346 'only_matching': True,
1349 def _page_url(self
, base_url
, pagenum
):
1350 url
= '%s/page:%d/' % (base_url
, pagenum
)
1351 request
= sanitized_Request(url
)
1352 # Set the header to get a partial html page with the ids,
1353 # the normal page doesn't contain them.
1354 request
.add_header('X-Requested-With', 'XMLHttpRequest')
1357 def _real_extract(self
, url
):
1358 return self
._extract
_videos
('watchlater', 'https://vimeo.com/watchlater')
1361 class VimeoLikesIE(VimeoChannelIE
):
1362 _VALID_URL
= r
'https://(?:www\.)?vimeo\.com/(?P<id>[^/]+)/likes/?(?:$|[?#]|sort:)'
1363 IE_NAME
= 'vimeo:likes'
1364 IE_DESC
= 'Vimeo user likes'
1366 'url': 'https://vimeo.com/user755559/likes/',
1367 'playlist_mincount': 293,
1370 'title': 'urza’s Likes',
1373 'url': 'https://vimeo.com/stormlapse/likes',
1374 'only_matching': True,
1377 def _page_url(self
, base_url
, pagenum
):
1378 return '%s/page:%d/' % (base_url
, pagenum
)
1380 def _real_extract(self
, url
):
1381 user_id
= self
._match
_id
(url
)
1382 return self
._extract
_videos
(user_id
, 'https://vimeo.com/%s/likes' % user_id
)
1385 class VHXEmbedIE(VimeoBaseInfoExtractor
):
1386 IE_NAME
= 'vhx:embed'
1387 _VALID_URL
= r
'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
1390 def _extract_url(webpage
):
1392 r
'<iframe[^>]+src="(https?://embed\.vhx\.tv/videos/\d+[^"]*)"', webpage
)
1393 return unescapeHTML(mobj
.group(1)) if mobj
else None
1395 def _real_extract(self
, url
):
1396 video_id
= self
._match
_id
(url
)
1397 webpage
= self
._download
_webpage
(url
, video_id
)
1398 config_url
= self
._parse
_json
(self
._search
_regex
(
1399 r
'window\.OTTData\s*=\s*({.+})', webpage
,
1400 'ott data'), video_id
, js_to_json
)['config_url']
1401 config
= self
._download
_json
(config_url
, video_id
)
1402 info
= self
._parse
_config
(config
, video_id
)
1403 info
['id'] = video_id
1404 self
._vimeo
_sort
_formats
(info
['formats'])