6 from .common
import InfoExtractor
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
, {'http_headers': {'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()
50 if 'http_headers' in data
:
51 headers
.update(data
['http_headers'])
52 return url
, data
, headers
54 def _perform_login(self
, username
, password
):
55 webpage
= self
._download
_webpage
(
56 self
._LOGIN
_URL
, None, 'Downloading login page')
57 token
, vuid
= self
._extract
_xsrft
_and
_vuid
(webpage
)
65 self
._set
_vimeo
_cookie
('vuid', vuid
)
67 self
._download
_webpage
(
68 self
._LOGIN
_URL
, None, 'Logging in',
69 data
=urlencode_postdata(data
), headers
={
70 'Content-Type': 'application/x-www-form-urlencoded',
71 'Referer': self
._LOGIN
_URL
,
73 except ExtractorError
as e
:
74 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 418:
76 'Unable to log in: bad username or password',
78 raise ExtractorError('Unable to log in')
80 def _real_initialize(self
):
81 if self
._LOGIN
_REQUIRED
and not self
._get
_cookies
('https://vimeo.com').get('vuid'):
82 self
._raise
_login
_required
()
84 def _get_video_password(self
):
85 password
= self
.get_param('videopassword')
88 'This video is protected by a password, use the --video-password option',
92 def _verify_video_password(self
, url
, video_id
, password
, token
, vuid
):
93 if url
.startswith('http://'):
94 # vimeo only supports https now, but the user can give an http url
95 url
= url
.replace('http://', 'https://')
96 self
._set
_vimeo
_cookie
('vuid', vuid
)
97 return self
._download
_webpage
(
98 url
+ '/password', video_id
, 'Verifying the password',
99 'Wrong password', data
=urlencode_postdata({
100 'password': password
,
103 'Content-Type': 'application/x-www-form-urlencoded',
107 def _extract_xsrft_and_vuid(self
, webpage
):
108 xsrft
= self
._search
_regex
(
109 r
'(?:(?P<q1>["\'])xsrft(?P
=q1
)\s
*:|xsrft\s
*[=:])\s
*(?P
<q
>["\'])(?P<xsrft>.+?)(?P=q)',
110 webpage, 'login token', group='xsrft')
111 vuid = self._search_regex(
112 r'["\']vuid
["\']\s*:\s*(["\'])(?P
<vuid
>.+?
)\
1',
113 webpage, 'vuid
', group='vuid
')
116 def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs):
117 vimeo_config = self._search_regex(
118 r'vimeo\
.config\s
*=\s
*(?
:({.+?}
)|_extend\
([^
,]+,\s
+({.+?}
)\
));',
119 webpage, 'vimeo config
', *args, **kwargs)
121 return self._parse_json(vimeo_config, video_id)
123 def _set_vimeo_cookie(self, name, value):
124 self._set_cookie('vimeo
.com
', name, value)
126 def _vimeo_sort_formats(self, formats):
127 # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
128 # at the same time without actual units specified.
129 self._sort_formats(formats, ('quality
', 'res
', 'fps
', 'hdr
:12', 'source
'))
131 def _parse_config(self, config, video_id):
132 video_data = config['video
']
133 video_title = video_data.get('title
')
134 live_event = video_data.get('live_event
') or {}
135 is_live = live_event.get('status
') == 'started
'
136 request = config.get('request
') or {}
141 config_files = video_data.get('files
') or request.get('files
') or {}
142 for f in (config_files.get('progressive
') or []):
143 video_url = f.get('url
')
148 'format_id
': 'http
-%s' % f.get('quality
'),
149 'source_preference
': 10,
150 'width
': int_or_none(f.get('width
')),
151 'height
': int_or_none(f.get('height
')),
152 'fps
': int_or_none(f.get('fps
')),
153 'tbr
': int_or_none(f.get('bitrate
')),
156 # TODO: fix handling of 308 status code returned for live archive manifest requests
157 sep_pattern = r'/sep
/video
/'
158 for files_type in ('hls
', 'dash
'):
159 for cdn_name, cdn_data in (try_get(config_files, lambda x: x[files_type]['cdns
']) or {}).items():
160 manifest_url = cdn_data.get('url
')
163 format_id = '%s-%s' % (files_type, cdn_name)
164 sep_manifest_urls = []
165 if re.search(sep_pattern, manifest_url):
166 for suffix, repl in (('', 'video
'), ('_sep
', 'sep
/video
')):
167 sep_manifest_urls.append((format_id + suffix, re.sub(
168 sep_pattern, '/%s/' % repl, manifest_url)))
170 sep_manifest_urls = [(format_id, manifest_url)]
171 for f_id, m_url in sep_manifest_urls:
172 if files_type == 'hls
':
173 fmts, subs = self._extract_m3u8_formats_and_subtitles(
174 m_url, video_id, 'mp4
', live=is_live, m3u8_id=f_id,
175 note='Downloading
%s m3u8 information
' % cdn_name,
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 'Downloading
%s MPD information
' % cdn_name,
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
')
223 duration = int_or_none(video_data.get('duration
'))
224 chapter_data = try_get(config, lambda x: x['embed
']['chapters
']) or []
226 'title
': current_chapter.get('title
'),
227 'start_time
': current_chapter.get('timecode
'),
228 'end_time
': next_chapter.get('timecode
'),
229 } for current_chapter, next_chapter in zip(chapter_data, chapter_data[1:] + [{'timecode': duration}])]
230 if chapters and chapters[0]['start_time
']: # Chapters may not start from 0
231 chapters[:0] = [{'title': '<Untitled>', 'start_time': 0, 'end_time': chapters[0]['start_time']}]
234 'id': str_or_none(video_data.get('id')) or video_id,
235 'title
': video_title,
236 'uploader
': owner.get('name
'),
237 'uploader_id
': video_uploader_url.split('/')[-1] if video_uploader_url else None,
238 'uploader_url
': video_uploader_url,
239 'thumbnails
': thumbnails,
240 'duration
': duration,
241 'chapters
': chapters or None,
243 'subtitles
': subtitles,
247 def _extract_original_format(self, url, video_id, unlisted_hash=None):
248 query = {'action': 'load_download_config'}
250 query['unlisted_hash
'] = unlisted_hash
251 download_data = self._download_json(
252 url, video_id, fatal=False, query=query,
253 headers={'X-Requested-With': 'XMLHttpRequest'},
254 expected_status=(403, 404)) or {}
255 source_file = download_data.get('source_file
')
256 download_url = try_get(source_file, lambda x: x['download_url
'])
257 if download_url and not source_file.get('is_cold
') and not source_file.get('is_defrosting
'):
258 source_name = source_file.get('public_name
', 'Original
')
259 if self._is_valid_url(download_url, video_id, '%s video
' % source_name):
261 source_file, lambda x: x['extension
'],
262 compat_str) or determine_ext(
263 download_url, None) or 'mp4
').lower()
267 'width
': int_or_none(source_file.get('width
')),
268 'height
': int_or_none(source_file.get('height
')),
269 'filesize
': parse_filesize(source_file.get('size
')),
270 'format_id
': source_name,
274 jwt_response = self._download_json(
275 'https
://vimeo
.com
/_rv
/viewer
', video_id, note='Downloading jwt token
', fatal=False) or {}
276 if not jwt_response.get('jwt
'):
278 headers = {'Authorization': 'jwt %s' % jwt_response['jwt']}
279 original_response = self._download_json(
280 f'https
://api
.vimeo
.com
/videos
/{video_id}
', video_id,
281 headers=headers, fatal=False, expected_status=(403, 404)) or {}
282 for download_data in original_response.get('download
') or []:
283 download_url = download_data.get('link
')
284 if not download_url or download_data.get('quality
') != 'source
':
286 ext = determine_ext(parse_qs(download_url).get('filename
', [''])[0].lower(), default_ext=None)
288 urlh = self._request_webpage(
289 HEADRequest(download_url), video_id, fatal=False, note='Determining source extension
')
290 ext = urlh and urlhandle_detect_ext(urlh)
293 'ext
': ext or 'unknown_video
',
294 'format_id
': download_data.get('public_name
', 'Original
'),
295 'width
': int_or_none(download_data.get('width
')),
296 'height
': int_or_none(download_data.get('height
')),
297 'fps
': int_or_none(download_data.get('fps
')),
298 'filesize
': int_or_none(download_data.get('size
')),
303 class VimeoIE(VimeoBaseInfoExtractor):
304 """Information extractor for vimeo.com."""
306 # _VALID_URL matches Vimeo URLs
307 _VALID_URL = r'''(?x)
317 (?!(?:channels|album|showcase)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/)
322 moogaloop\.swf)\?clip_id=
326 (?:/(?P<unlisted_hash>[\da-f]{10}))?
327 /?(?:[?&].*)?(?:[#].*)?$
332 r'<iframe
[^
>]+?src
=(["\'])(?P<url>(?:https?:)?//player\.vimeo\.com/video/\d+.*?)\1',
333 # Embedded (swf embed) Vimeo player
334 r'<embed[^>]+?src=(["\'])(?P
<url
>(?
:https?
:)?
//(?
:www\
.)?vimeo\
.com
/moogaloop\
.swf
.+?
)\
1',
335 # Non-standard embedded Vimeo player
336 r'<video
[^
>]+src
=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/[0-9]+)\1',
340 'url': 'http://vimeo.com/56015672#at=0',
341 'md5': '8879b6cc097e987f02484baf890129e5',
345 'title': "youtube
-dl test video
'' ä↭𝕐
-BaW jenozKc
",
346 'description': 'md5:2d3305bad981a06ff79f027f19865021',
347 'timestamp': 1355990239,
348 'upload_date': '20121220',
349 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user7108434',
350 'uploader_id': 'user7108434',
351 'uploader': 'Filippo Valsorda',
356 'format': 'best[protocol=https]',
358 'skip': 'No longer available'
361 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
362 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
363 'note': 'Vimeo Pro video (#1197)',
367 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/openstreetmapus',
368 'uploader_id': 'openstreetmapus',
369 'uploader': 'OpenStreetMap US',
370 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
371 'description': 'md5:2c362968038d4499f4d79f88458590c1',
373 'upload_date': '20130610',
374 'timestamp': 1370893156,
376 'thumbnail': 'https://i.vimeocdn.com/video/440260469-19b0d92fca3bd84066623b53f1eb8aaa3980c6c809e2d67b6b39ab7b4a77a344-d_960',
378 'comment_count': int,
382 'format': 'best[protocol=https]',
386 'url': 'http://player.vimeo.com/video/54469442',
387 'md5': 'b3e7f4d2cbb53bd7dc3bb6ff4ed5cfbd',
388 'note': 'Videos that embed the url in the player page',
392 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
393 'uploader': 'Business of Software',
394 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/businessofsoftware',
395 'uploader_id': 'businessofsoftware',
398 'thumbnail': 'https://i.vimeocdn.com/video/376682406-f34043e7b766af6bef2af81366eacd6724f3fc3173179a11a97a1e26587c9529-d_1280',
401 'format': 'best[protocol=https]',
405 'url': 'http://vimeo.com/68375962',
406 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
407 'note': 'Video protected with password',
411 'title': 'youtube-dl password protected test video',
412 'timestamp': 1371200155,
413 'upload_date': '20130614',
414 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user18948128',
415 'uploader_id': 'user18948128',
416 'uploader': 'Jaime Marquínez Ferrándiz',
418 'description': 'md5:dca3ea23adb29ee387127bc4ddfce63f',
419 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_960',
421 'comment_count': int,
425 'format': 'best[protocol=https]',
426 'videopassword': 'youtube-dl',
430 'url': 'http://vimeo.com/channels/keypeele/75629013',
431 'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
435 'title': 'Key & Peele: Terrorist Interrogation',
436 'description': 'md5:8678b246399b070816b12313e8b4eb5c',
437 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/atencio',
438 'uploader_id': 'atencio',
439 'uploader': 'Peter Atencio',
440 'channel_id': 'keypeele',
441 'channel_url': r're:https?://(?:www\.)?vimeo\.com/channels/keypeele',
442 'timestamp': 1380339469,
443 'upload_date': '20130928',
445 'thumbnail': 'https://i.vimeocdn.com/video/450239872-a05512d9b1e55d707a7c04365c10980f327b06d966351bc403a5d5d65c95e572-d_1280',
447 'comment_count': int,
450 'params': {'format': 'http-1080p'},
453 'url': 'http://vimeo.com/76979871',
454 'note': 'Video with subtitles',
458 'title': 'The New Vimeo Player (You Know, For Videos)',
459 'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
460 'timestamp': 1381846109,
461 'upload_date': '20131015',
462 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/staff',
463 'uploader_id': 'staff',
464 'uploader': 'Vimeo Staff',
467 'de': [{'ext': 'vtt'}],
468 'en': [{'ext': 'vtt'}],
469 'es': [{'ext': 'vtt'}],
470 'fr': [{'ext': 'vtt'}],
473 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'],
476 # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/
477 'url': 'https://player.vimeo.com/video/98044508',
478 'note': 'The js code contains assignments to the same variable as the config',
482 'title': 'Pier Solar OUYA Official Trailer',
483 'uploader': 'Tulio Gonçalves',
484 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user28849593',
485 'uploader_id': 'user28849593',
487 'thumbnail': 'https://i.vimeocdn.com/video/478636036-c18440305ef3df9decfb6bf207a61fe39d2d17fa462a96f6f2d93d30492b037d-d_1280',
491 # contains original format
492 'url': 'https://vimeo.com/33951933',
493 'md5': '53c688fa95a55bf4b7293d37a89c5c53',
497 'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute',
498 'uploader': 'The DMCI',
499 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/dmci',
500 'uploader_id': 'dmci',
501 'timestamp': 1324343742,
502 'upload_date': '20111220',
503 'description': 'md5:ae23671e82d05415868f7ad1aec21147',
505 'comment_count': int,
507 'thumbnail': 'https://i.vimeocdn.com/video/231174622-dd07f015e9221ff529d451e1cc31c982b5d87bfafa48c4189b1da72824ee289a-d_1280',
512 'note': 'Contains original format not accessible in webpage',
513 'url': 'https://vimeo.com/393756517',
514 'md5': 'c464af248b592190a5ffbb5d33f382b0',
518 'timestamp': 1582642091,
519 'uploader_id': 'frameworkla',
520 'title': 'Straight To Hell - Sabrina: Netflix',
521 'uploader': 'Framework Studio',
522 'description': 'md5:f2edc61af3ea7a5592681ddbb683db73',
523 'upload_date': '20200225',
525 'thumbnail': 'https://i.vimeocdn.com/video/859377297-836494a4ef775e9d4edbace83937d9ad34dc846c688c0c419c0e87f7ab06c4b3-d_1280',
526 'uploader_url': 'https://vimeo.com/frameworkla',
530 # only available via https://vimeo.com/channels/tributes/6213729 and
531 # not via https://vimeo.com/6213729
532 'url': 'https://vimeo.com/channels/tributes/6213729',
536 'title': 'Vimeo Tribute: The Shining',
537 'uploader': 'Casey Donahue',
538 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/caseydonahue',
539 'uploader_id': 'caseydonahue',
540 'channel_url': r're:https?://(?:www\.)?vimeo\.com/channels/tributes',
541 'channel_id': 'tributes',
542 'timestamp': 1250886430,
543 'upload_date': '20090821',
544 'description': 'md5:bdbf314014e58713e6e5b66eb252f4a6',
546 'comment_count': int,
548 'thumbnail': 'https://i.vimeocdn.com/video/22728298-bfc22146f930de7cf497821c7b0b9f168099201ecca39b00b6bd31fcedfca7a6-d_1280',
552 'skip_download': True,
556 # redirects to ondemand extractor and should be passed through it
557 # for successful extraction
558 'url': 'https://vimeo.com/73445910',
562 'title': 'The Reluctant Revolutionary',
563 'uploader': '10Ft Films',
564 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/tenfootfilms',
565 'uploader_id': 'tenfootfilms',
566 'description': 'md5:0fa704e05b04f91f40b7f3ca2e801384',
567 'upload_date': '20130830',
568 'timestamp': 1377853339,
571 'skip_download': True,
573 'skip': 'this page is no longer available.',
576 'url': 'http://player.vimeo.com/video/68375962',
577 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
581 'title': 'youtube-dl password protected test video',
582 'timestamp': 1371200155,
583 'upload_date': '20130614',
584 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/user18948128',
585 'uploader_id': 'user18948128',
586 'uploader': 'Jaime Marquínez Ferrándiz',
588 'description': 'md5:dca3ea23adb29ee387127bc4ddfce63f',
589 'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_960',
591 'comment_count': int,
595 'format': 'best[protocol=https]',
596 'videopassword': 'youtube-dl',
600 'url': 'http://vimeo.com/moogaloop.swf?clip_id=2539741',
601 'only_matching': True,
604 'url': 'https://vimeo.com/109815029',
605 'note': 'Video not completely processed, "failed
" seed status',
606 'only_matching': True,
609 'url': 'https://vimeo.com/groups/travelhd/videos/22439234',
610 'only_matching': True,
613 'url': 'https://vimeo.com/album/2632481/video/79010983',
614 'only_matching': True,
617 'url': 'https://vimeo.com/showcase/3253534/video/119195465',
618 'note': 'A video in a password protected album (showcase)',
622 'title': "youtube
-dl test video
'' ä↭𝕐
-BaW jenozKc
",
623 'uploader': 'Philipp Hagemeister',
624 'uploader_id': 'user20132939',
625 'description': 'md5:fa7b6c6d8db0bdc353893df2f111855b',
626 'upload_date': '20150209',
627 'timestamp': 1423518307,
628 'thumbnail': 'https://i.vimeocdn.com/video/default_1280',
631 'uploader_url': 'https://vimeo.com/user20132939',
633 'comment_count': int,
636 'format': 'best[protocol=https]',
637 'videopassword': 'youtube-dl',
641 # source file returns 403: Forbidden
642 'url': 'https://vimeo.com/7809605',
643 'only_matching': True,
646 'note': 'Direct URL with hash',
647 'url': 'https://vimeo.com/160743502/abd0e13fb4',
651 'uploader': 'Julian Tryba',
652 'uploader_id': 'aliniamedia',
653 'title': 'Harrisville New Hampshire',
654 'timestamp': 1459259666,
655 'upload_date': '20160329',
656 'release_timestamp': 1459259666,
659 'comment_count': int,
660 'thumbnail': 'https://i.vimeocdn.com/video/562802436-585eeb13b5020c6ac0f171a2234067938098f84737787df05ff0d767f6d54ee9-d_1280',
662 'uploader_url': 'https://vimeo.com/aliniamedia',
663 'release_date': '20160329',
665 'params': {'skip_download': True},
668 'url': 'https://vimeo.com/138909882',
672 'title': 'Eastnor Castle 2015 Firework Champions - The Promo!',
673 'description': 'md5:5967e090768a831488f6e74b7821b3c1',
674 'uploader_id': 'fireworkchampions',
675 'uploader': 'Firework Champions',
676 'upload_date': '20150910',
677 'timestamp': 1441901895,
680 'skip_download': True,
681 'format': 'Original',
685 'url': 'https://vimeo.com/channels/staffpicks/143603739',
689 'uploader': 'Karim Huu Do',
690 'timestamp': 1445846953,
691 'upload_date': '20151026',
692 'title': 'The Shoes - Submarine Feat. Blaine Harrison',
693 'uploader_id': 'karimhd',
694 'description': 'md5:8e2eea76de4504c2e8020a9bcfa1e843',
695 'channel_id': 'staffpicks',
697 'comment_count': int,
699 'thumbnail': 'https://i.vimeocdn.com/video/541243181-b593db36a16db2f0096f655da3f5a4dc46b8766d77b0f440df937ecb0c418347-d_1280',
701 'uploader_url': 'https://vimeo.com/karimhd',
702 'channel_url': 'https://vimeo.com/channels/staffpicks',
704 'params': {'skip_download': 'm3u8'},
707 # requires passing unlisted_hash(a52724358e) to load_download_config request
708 'url': 'https://vimeo.com/392479337/a52724358e',
709 'only_matching': True,
712 # similar, but all numeric: ID must be 581039021, not 9603038895
714 'url': 'https://vimeo.com/581039021/9603038895',
718 'timestamp': 1627621014,
719 'release_timestamp': 1627621014,
721 'comment_count': int,
722 'thumbnail': 'https://i.vimeocdn.com/video/1202249320-4ddb2c30398c0dc0ee059172d1bd5ea481ad12f0e0e3ad01d2266f56c744b015-d_1280',
724 'uploader_url': 'https://vimeo.com/txwestcapital',
725 'release_date': '20210730',
726 'uploader': 'Christopher Inks',
727 'title': 'Thursday, July 29, 2021 BMA Evening Video Update',
728 'uploader_id': 'txwestcapital',
729 'upload_date': '20210730',
732 'skip_download': True,
735 # https://gettingthingsdone.com/workflowmap/
736 # vimeo embed with check-password page protected by Referer header
740 def _extract_embed_urls(cls, url, webpage):
741 for embed_url in super()._extract_embed_urls(url, webpage):
742 yield cls._smuggle_referrer(embed_url, url)
745 def _extract_url(cls, url, webpage):
746 return next(cls._extract_embed_urls(url, webpage), None)
748 def _verify_player_video_password(self, url, video_id, headers):
749 password = self._get_video_password()
750 data = urlencode_postdata({
751 'password': base64.b64encode(password.encode()),
753 headers = merge_dicts(headers, {
754 'Content-Type': 'application/x-www-form-urlencoded',
756 checked = self._download_json(
757 f'{compat_urlparse.urlsplit(url)._replace(query=None).geturl()}/check-password',
758 video_id, 'Verifying the password', data=data, headers=headers)
760 raise ExtractorError('Wrong video password', expected=True)
763 def _extract_from_api(self, video_id, unlisted_hash=None):
764 token = self._download_json(
765 'https://vimeo.com/_rv/jwt', video_id, headers={
766 'X-Requested-With': 'XMLHttpRequest'
768 api_url = 'https://api.vimeo.com/videos/' + video_id
770 api_url += ':' + unlisted_hash
771 video = self._download_json(
772 api_url, video_id, headers={
773 'Authorization': 'jwt ' + token,
775 'fields': 'config_url,created_time,description,license,metadata.connections.comments.total,metadata.connections.likes.total,release_time,stats.plays',
777 info = self._parse_config(self._download_json(
778 video['config_url'], video_id), video_id)
779 self._vimeo_sort_formats(info['formats'])
780 get_timestamp = lambda x: parse_iso8601(video.get(x + '_time'))
782 'description': video.get('description'),
783 'license': video.get('license'),
784 'release_timestamp': get_timestamp('release'),
785 'timestamp': get_timestamp('created'),
786 'view_count': int_or_none(try_get(video, lambda x: x['stats']['plays'])),
788 connections = try_get(
789 video, lambda x: x['metadata']['connections'], dict) or {}
790 for k in ('comment', 'like'):
791 info[k + '_count'] = int_or_none(try_get(connections, lambda x: x[k + 's']['total']))
794 def _try_album_password(self, url):
795 album_id = self._search_regex(
796 r'vimeo\.com/(?:album|showcase)/([^/]+)', url, 'album id', default=None)
799 viewer = self._download_json(
800 'https://vimeo.com/_rv/viewer', album_id, fatal=False)
802 webpage = self._download_webpage(url, album_id)
803 viewer = self._parse_json(self._search_regex(
804 r'bootstrap_data\s*=\s*({.+?})</script>',
805 webpage, 'bootstrap data'), album_id)['viewer']
807 album = self._download_json(
808 'https://api.vimeo.com/albums/' + album_id,
809 album_id, headers={'Authorization': 'jwt ' + jwt},
810 query={'fields': 'description,name,privacy'})
811 if try_get(album, lambda x: x['privacy']['view']) == 'password':
812 password = self.get_param('videopassword')
814 raise ExtractorError(
815 'This album is protected by a password, use the --video-password option',
817 self._set_vimeo_cookie('vuid', viewer['vuid'])
820 'https://vimeo.com/showcase/%s/auth' % album_id,
821 album_id, 'Verifying the password', data=urlencode_postdata({
822 'password': password,
823 'token': viewer['xsrft'],
825 'X-Requested-With': 'XMLHttpRequest',
827 except ExtractorError as e:
828 if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401:
829 raise ExtractorError('Wrong password', expected=True)
832 def _real_extract(self, url):
833 url, data, headers = self._unsmuggle_headers(url)
834 if 'Referer' not in headers:
835 headers['Referer'] = url
837 # Extract ID from URL
838 mobj = self._match_valid_url(url).groupdict()
839 video_id, unlisted_hash = mobj['id'], mobj.get('unlisted_hash')
841 return self._extract_from_api(video_id, unlisted_hash)
844 is_pro = 'vimeopro.com/' in url
846 # some videos require portfolio_id to be present in player url
847 # https://github.com/ytdl-org/youtube-dl/issues/20070
848 url = self._extract_url(url, self._download_webpage(url, video_id))
850 url = 'https://vimeo.com/' + video_id
851 elif any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')):
852 url = 'https://vimeo.com/' + video_id
854 self._try_album_password(url)
856 # Retrieve video webpage to extract further information
857 webpage, urlh = self._download_webpage_handle(
858 url, video_id, headers=headers)
859 redirect_url = urlh.geturl()
860 except ExtractorError as ee:
861 if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
862 errmsg = ee.cause.read()
863 if b'Because of its privacy settings, this video cannot be played here' in errmsg:
864 raise ExtractorError(
865 'Cannot download embed-only video without embedding '
866 'URL. Please call yt-dlp with the URL of the page '
867 'that embeds this video.',
871 if '://player.vimeo.com/video/' in url:
872 config = self._parse_json(self._search_regex(
873 r'\bconfig\s*=\s*({.+?})\s*;', webpage, 'info section'), video_id)
874 if config.get('view') == 4:
875 config = self._verify_player_video_password(
876 redirect_url, video_id, headers)
877 info = self._parse_config(config, video_id)
878 self._vimeo_sort_formats(info['formats'])
881 if re.search(r'<form[^>]+?id="pw_form
"', webpage):
882 video_password = self._get_video_password()
883 token, vuid = self._extract_xsrft_and_vuid(webpage)
884 webpage = self._verify_video_password(
885 redirect_url, video_id, video_password, token, vuid)
887 vimeo_config = self._extract_vimeo_config(webpage, video_id, default=None)
889 seed_status = vimeo_config.get('seed_status') or {}
890 if seed_status.get('state') == 'failed':
891 raise ExtractorError(
892 '%s said: %s' % (self.IE_NAME, seed_status['title']),
897 video_description = None
901 channel_id = self._search_regex(
902 r'vimeo\.com/channels/([^/]+)', url, 'channel id', default=None)
904 config_url = self._html_search_regex(
905 r'\bdata-config-url="([^
"]+)"', webpage, 'config URL
', default=None)
906 video_description = clean_html(get_element_by_class('description
', webpage))
908 'channel_id
': channel_id,
909 'channel_url
': 'https
://vimeo
.com
/channels
/' + channel_id,
912 page_config = self._parse_json(self._search_regex(
913 r'vimeo\
.(?
:clip|vod_title
)_page_config\s
*=\s
*({.+?}
);',
914 webpage, 'page config
', default='{}'), video_id, fatal=False)
916 return self._extract_from_api(video_id)
917 config_url = page_config['player
']['config_url
']
918 cc_license = page_config.get('cc_license
')
919 clip = page_config.get('clip
') or {}
920 timestamp = clip.get('uploaded_on
')
921 video_description = clean_html(
922 clip.get('description
') or page_config.get('description_html_escaped
'))
923 config = self._download_json(config_url, video_id)
924 video = config.get('video
') or {}
925 vod = video.get('vod
') or {}
928 if '>You rented this title
.<' in webpage:
930 if try_get(config, lambda x: x['user
']['purchased
']):
932 for purchase_option in (vod.get('purchase_options
') or []):
933 if purchase_option.get('purchased
'):
935 label = purchase_option.get('label_string
')
936 if label and (label.startswith('You rented this
') or label.endswith(' remaining
')):
940 if is_rented() and vod.get('is_trailer
'):
941 feature_id = vod.get('feature_id
')
942 if feature_id and not data.get('force_feature_id
', False):
943 return self.url_result(smuggle_url(
944 'https
://player
.vimeo
.com
/player
/%s' % feature_id,
945 {'force_feature_id': True}), 'Vimeo
')
947 if not video_description:
948 video_description = self._html_search_regex(
949 r'(?s
)<div\s
+class="[^"]*description
[^
"]*"[^
>]*>(.*?
)</div
>',
950 webpage, 'description
', default=None)
951 if not video_description:
952 video_description = self._html_search_meta(
953 ['description
', 'og
:description
', 'twitter
:description
'],
954 webpage, default=None)
955 if not video_description and is_pro:
956 orig_webpage = self._download_webpage(
958 note='Downloading webpage
for description
',
961 video_description = self._html_search_meta(
962 'description
', orig_webpage, default=None)
963 if not video_description:
964 self.report_warning('Cannot find video description
')
967 timestamp = self._search_regex(
968 r'<time
[^
>]+datetime
="([^"]+)"', webpage,
969 'timestamp', default=None)
971 view_count = int_or_none(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count', default=None))
972 like_count = int_or_none(self._search_regex(r'UserLikes:(\d+)', webpage, 'like count', default=None))
973 comment_count = int_or_none(self._search_regex(r'UserComments:(\d+)', webpage, 'comment count', default=None))
977 source_format = self._extract_original_format(
978 'https://vimeo.com/' + video_id, video_id, video.get('unlisted_hash'))
980 formats.append(source_format)
982 info_dict_config = self._parse_config(config, video_id)
983 formats.extend(info_dict_config['formats'])
984 self._vimeo_sort_formats(formats)
986 json_ld = self._search_json_ld(webpage, video_id, default={})
989 cc_license = self._search_regex(
990 r'<link[^>]+rel=["\']license
["\'][^>]+href=(["\'])(?P
<license
>(?
:(?
!\
1).)+)\
1',
991 webpage, 'license
', default=None, group='license
')
995 'timestamp
': unified_timestamp(timestamp),
996 'description
': video_description,
998 'view_count
': view_count,
999 'like_count
': like_count,
1000 'comment_count
': comment_count,
1001 'license
': cc_license,
1004 return merge_dicts(info_dict, info_dict_config, json_ld)
1007 class VimeoOndemandIE(VimeoIE):
1008 IE_NAME = 'vimeo
:ondemand
'
1009 _VALID_URL = r'https?
://(?
:www\
.)?vimeo\
.com
/ondemand
/(?
:[^
/]+/)?
(?P
<id>[^
/?
#&]+)'
1011 # ondemand video not available via https://vimeo.com/id
1012 'url': 'https://vimeo.com/ondemand/20704',
1013 'md5': 'c424deda8c7f73c1dfb3edd7630e2f35',
1017 'title': 'המעבדה - במאי יותם פלדמן',
1018 'uploader': 'גם סרטים',
1019 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/gumfilms',
1020 'uploader_id': 'gumfilms',
1021 'description': 'md5:aeeba3dbd4d04b0fa98a4fdc9c639998',
1022 'upload_date': '20140906',
1023 'timestamp': 1410032453,
1024 'thumbnail': 'https://i.vimeocdn.com/video/488238335-d7bf151c364cff8d467f1b73784668fe60aae28a54573a35d53a1210ae283bd8-d_1280',
1025 'comment_count': int,
1026 'license': 'https://creativecommons.org/licenses/by-nc-nd/3.0/',
1032 'format': 'best[protocol=https]',
1034 'expected_warnings': ['Unable to download JSON metadata'],
1036 # requires Referer to be passed along with og:video:url
1037 'url': 'https://vimeo.com/ondemand/36938/126682985',
1041 'title': 'Rävlock, rätt läte på rätt plats',
1042 'uploader': 'Lindroth & Norin',
1043 'uploader_url': r
're:https?://(?:www\.)?vimeo\.com/lindrothnorin',
1044 'uploader_id': 'lindrothnorin',
1045 'description': 'md5:c3c46a90529612c8279fb6af803fc0df',
1046 'upload_date': '20150502',
1047 'timestamp': 1430586422,
1049 'comment_count': int,
1051 'thumbnail': 'https://i.vimeocdn.com/video/517077723-7066ae1d9a79d3eb361334fb5d58ec13c8f04b52f8dd5eadfbd6fb0bcf11f613-d_1280',
1055 'skip_download': True,
1057 'expected_warnings': ['Unable to download JSON metadata'],
1059 'url': 'https://vimeo.com/ondemand/nazmaalik',
1060 'only_matching': True,
1062 'url': 'https://vimeo.com/ondemand/141692381',
1063 'only_matching': True,
1065 'url': 'https://vimeo.com/ondemand/thelastcolony/150274832',
1066 'only_matching': True,
1070 class VimeoChannelIE(VimeoBaseInfoExtractor
):
1071 IE_NAME
= 'vimeo:channel'
1072 _VALID_URL
= r
'https://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
1073 _MORE_PAGES_INDICATOR
= r
'<a.+?rel="next"'
1075 _TITLE_RE
= r
'<link rel="alternate"[^>]+?title="(.*?)"'
1077 'url': 'https://vimeo.com/channels/tributes',
1080 'title': 'Vimeo Tributes',
1082 'playlist_mincount': 22,
1084 _BASE_URL_TEMPL
= 'https://vimeo.com/channels/%s'
1086 def _page_url(self
, base_url
, pagenum
):
1087 return '%s/videos/page:%d/' % (base_url
, pagenum
)
1089 def _extract_list_title(self
, webpage
):
1090 return self
._TITLE
or self
._html
_search
_regex
(
1091 self
._TITLE
_RE
, webpage
, 'list title', fatal
=False)
1093 def _title_and_entries(self
, list_id
, base_url
):
1094 for pagenum
in itertools
.count(1):
1095 page_url
= self
._page
_url
(base_url
, pagenum
)
1096 webpage
= self
._download
_webpage
(
1098 'Downloading page %s' % pagenum
)
1101 yield self
._extract
_list
_title
(webpage
)
1103 # Try extracting href first since not all videos are available via
1104 # short https://vimeo.com/id URL (e.g. https://vimeo.com/channels/tributes/6213729)
1106 r
'id="clip_(\d+)"[^>]*>\s*<a[^>]+href="(/(?:[^/]+/)*\1)(?:[^>]+\btitle="([^"]+)")?', webpage
)
1108 for video_id
, video_url
, video_title
in clips
:
1109 yield self
.url_result(
1110 compat_urlparse
.urljoin(base_url
, video_url
),
1111 VimeoIE
.ie_key(), video_id
=video_id
, video_title
=video_title
)
1112 # More relaxed fallback
1114 for video_id
in re
.findall(r
'id=["\']clip_(\d
+)', webpage):
1115 yield self.url_result(
1116 'https
://vimeo
.com
/%s' % video_id,
1117 VimeoIE.ie_key(), video_id=video_id)
1119 if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
1122 def _extract_videos(self, list_id, base_url):
1123 title_and_entries = self._title_and_entries(list_id, base_url)
1124 list_title = next(title_and_entries)
1125 return self.playlist_result(title_and_entries, list_id, list_title)
1127 def _real_extract(self, url):
1128 channel_id = self._match_id(url)
1129 return self._extract_videos(channel_id, self._BASE_URL_TEMPL % channel_id)
1132 class VimeoUserIE(VimeoChannelIE):
1133 IE_NAME = 'vimeo
:user
'
1134 _VALID_URL = r'https
://vimeo\
.com
/(?
!(?
:[0-9]+|watchlater
)(?
:$|
[?
#/]))(?P<id>[^/]+)(?:/videos)?/?(?:$|[?#])'
1135 _TITLE_RE
= r
'<a[^>]+?class="user">([^<>]+?)</a>'
1137 'url': 'https://vimeo.com/nkistudio/videos',
1142 'playlist_mincount': 66,
1144 'url': 'https://vimeo.com/nkistudio/',
1145 'only_matching': True,
1147 _BASE_URL_TEMPL
= 'https://vimeo.com/%s'
1150 class VimeoAlbumIE(VimeoBaseInfoExtractor
):
1151 IE_NAME
= 'vimeo:album'
1152 _VALID_URL
= r
'https://vimeo\.com/(?:album|showcase)/(?P<id>\d+)(?:$|[?#]|/(?!video))'
1153 _TITLE_RE
= r
'<header id="page_header">\n\s*<h1>(.*?)</h1>'
1155 'url': 'https://vimeo.com/album/2632481',
1158 'title': 'Staff Favorites: November 2013',
1160 'playlist_mincount': 13,
1162 'note': 'Password-protected album',
1163 'url': 'https://vimeo.com/album/3253534',
1168 'playlist_count': 1,
1170 'videopassword': 'youtube-dl',
1175 def _fetch_page(self
, album_id
, authorization
, hashed_pass
, page
):
1178 'fields': 'link,uri',
1180 'per_page': self
._PAGE
_SIZE
,
1183 query
['_hashed_pass'] = hashed_pass
1185 videos
= self
._download
_json
(
1186 'https://api.vimeo.com/albums/%s/videos' % album_id
,
1187 album_id
, 'Downloading page %d' % api_page
, query
=query
, headers
={
1188 'Authorization': 'jwt ' + authorization
,
1190 except ExtractorError
as e
:
1191 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 400:
1193 for video
in videos
:
1194 link
= video
.get('link')
1197 uri
= video
.get('uri')
1198 video_id
= self
._search
_regex
(r
'/videos/(\d+)', uri
, 'video_id', default
=None) if uri
else None
1199 yield self
.url_result(link
, VimeoIE
.ie_key(), video_id
)
1201 def _real_extract(self
, url
):
1202 album_id
= self
._match
_id
(url
)
1203 viewer
= self
._download
_json
(
1204 'https://vimeo.com/_rv/viewer', album_id
, fatal
=False)
1206 webpage
= self
._download
_webpage
(url
, album_id
)
1207 viewer
= self
._parse
_json
(self
._search
_regex
(
1208 r
'bootstrap_data\s*=\s*({.+?})</script>',
1209 webpage
, 'bootstrap data'), album_id
)['viewer']
1211 album
= self
._download
_json
(
1212 'https://api.vimeo.com/albums/' + album_id
,
1213 album_id
, headers
={'Authorization': 'jwt ' + jwt}
,
1214 query
={'fields': 'description,name,privacy'}
)
1216 if try_get(album
, lambda x
: x
['privacy']['view']) == 'password':
1217 password
= self
.get_param('videopassword')
1219 raise ExtractorError(
1220 'This album is protected by a password, use the --video-password option',
1222 self
._set
_vimeo
_cookie
('vuid', viewer
['vuid'])
1224 hashed_pass
= self
._download
_json
(
1225 'https://vimeo.com/showcase/%s/auth' % album_id
,
1226 album_id
, 'Verifying the password', data
=urlencode_postdata({
1227 'password': password
,
1228 'token': viewer
['xsrft'],
1230 'X-Requested-With': 'XMLHttpRequest',
1232 except ExtractorError
as e
:
1233 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 401:
1234 raise ExtractorError('Wrong password', expected
=True)
1236 entries
= OnDemandPagedList(functools
.partial(
1237 self
._fetch
_page
, album_id
, jwt
, hashed_pass
), self
._PAGE
_SIZE
)
1238 return self
.playlist_result(
1239 entries
, album_id
, album
.get('name'), album
.get('description'))
1242 class VimeoGroupsIE(VimeoChannelIE
):
1243 IE_NAME
= 'vimeo:group'
1244 _VALID_URL
= r
'https://vimeo\.com/groups/(?P<id>[^/]+)(?:/(?!videos?/\d+)|$)'
1246 'url': 'https://vimeo.com/groups/meetup',
1249 'title': 'Vimeo Meetup!',
1251 'playlist_mincount': 27,
1253 _BASE_URL_TEMPL
= 'https://vimeo.com/groups/%s'
1256 class VimeoReviewIE(VimeoBaseInfoExtractor
):
1257 IE_NAME
= 'vimeo:review'
1258 IE_DESC
= 'Review pages on vimeo'
1259 _VALID_URL
= r
'(?P<url>https://vimeo\.com/[^/]+/review/(?P<id>[^/]+)/[0-9a-f]{10})'
1261 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
1262 'md5': 'c507a72f780cacc12b2248bb4006d253',
1266 'title': "DICK HARDWICK 'Comedian'",
1267 'uploader': 'Richard Hardwick',
1268 'uploader_id': 'user21297594',
1269 'description': "Comedian Dick Hardwick's five minute demo filmed in front of a live theater audience.\nEdit by Doug Mattocks",
1271 'thumbnail': 'https://i.vimeocdn.com/video/450115033-43303819d9ebe24c2630352e18b7056d25197d09b3ae901abdac4c4f1d68de71-d_1280',
1272 'uploader_url': 'https://vimeo.com/user21297594',
1275 'note': 'video player needs Referer',
1276 'url': 'https://vimeo.com/user22258446/review/91613211/13f927e053',
1277 'md5': '6295fdab8f4bf6a002d058b2c6dce276',
1281 'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn',
1282 'uploader': 'DevWeek Events',
1284 'thumbnail': r
're:^https?://.*\.jpg$',
1285 'uploader_id': 'user22258446',
1287 'skip': 'video gone',
1289 'note': 'Password protected',
1290 'url': 'https://vimeo.com/user37284429/review/138823582/c4d865efde',
1294 'title': 'EFFICIENT PICKUP MASTERCLASS MODULE 1',
1296 'uploader_id': 'user37284429',
1299 'videopassword': 'holygrail',
1301 'skip': 'video gone',
1304 def _real_extract(self
, url
):
1305 page_url
, video_id
= self
._match
_valid
_url
(url
).groups()
1306 data
= self
._download
_json
(
1307 page_url
.replace('/review/', '/review/data/'), video_id
)
1308 if data
.get('isLocked') is True:
1309 video_password
= self
._get
_video
_password
()
1310 viewer
= self
._download
_json
(
1311 'https://vimeo.com/_rv/viewer', video_id
)
1312 webpage
= self
._verify
_video
_password
(
1313 'https://vimeo.com/' + video_id
, video_id
,
1314 video_password
, viewer
['xsrft'], viewer
['vuid'])
1315 clip_page_config
= self
._parse
_json
(self
._search
_regex
(
1316 r
'window\.vimeo\.clip_page_config\s*=\s*({.+?});',
1317 webpage
, 'clip page config'), video_id
)
1318 config_url
= clip_page_config
['player']['config_url']
1319 clip_data
= clip_page_config
.get('clip') or {}
1321 clip_data
= data
['clipData']
1322 config_url
= clip_data
['configUrl']
1323 config
= self
._download
_json
(config_url
, video_id
)
1324 info_dict
= self
._parse
_config
(config
, video_id
)
1325 source_format
= self
._extract
_original
_format
(
1326 page_url
+ '/action', video_id
)
1328 info_dict
['formats'].append(source_format
)
1329 self
._vimeo
_sort
_formats
(info_dict
['formats'])
1330 info_dict
['description'] = clean_html(clip_data
.get('description'))
1334 class VimeoWatchLaterIE(VimeoChannelIE
):
1335 IE_NAME
= 'vimeo:watchlater'
1336 IE_DESC
= 'Vimeo watch later list, ":vimeowatchlater" keyword (requires authentication)'
1337 _VALID_URL
= r
'https://vimeo\.com/(?:home/)?watchlater|:vimeowatchlater'
1338 _TITLE
= 'Watch Later'
1339 _LOGIN_REQUIRED
= True
1341 'url': 'https://vimeo.com/watchlater',
1342 'only_matching': True,
1345 def _page_url(self
, base_url
, pagenum
):
1346 url
= '%s/page:%d/' % (base_url
, pagenum
)
1347 request
= sanitized_Request(url
)
1348 # Set the header to get a partial html page with the ids,
1349 # the normal page doesn't contain them.
1350 request
.add_header('X-Requested-With', 'XMLHttpRequest')
1353 def _real_extract(self
, url
):
1354 return self
._extract
_videos
('watchlater', 'https://vimeo.com/watchlater')
1357 class VimeoLikesIE(VimeoChannelIE
):
1358 _VALID_URL
= r
'https://(?:www\.)?vimeo\.com/(?P<id>[^/]+)/likes/?(?:$|[?#]|sort:)'
1359 IE_NAME
= 'vimeo:likes'
1360 IE_DESC
= 'Vimeo user likes'
1362 'url': 'https://vimeo.com/user755559/likes/',
1363 'playlist_mincount': 293,
1366 'title': 'urza’s Likes',
1369 'url': 'https://vimeo.com/stormlapse/likes',
1370 'only_matching': True,
1373 def _page_url(self
, base_url
, pagenum
):
1374 return '%s/page:%d/' % (base_url
, pagenum
)
1376 def _real_extract(self
, url
):
1377 user_id
= self
._match
_id
(url
)
1378 return self
._extract
_videos
(user_id
, 'https://vimeo.com/%s/likes' % user_id
)
1381 class VHXEmbedIE(VimeoBaseInfoExtractor
):
1382 IE_NAME
= 'vhx:embed'
1383 _VALID_URL
= r
'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
1384 _EMBED_REGEX
= [r
'<iframe[^>]+src="(?P<url>https?://embed\.vhx\.tv/videos/\d+[^"]*)"']
1387 def _extract_embed_urls(cls
, url
, webpage
):
1388 for embed_url
in super()._extract
_embed
_urls
(url
, webpage
):
1389 yield cls
._smuggle
_referrer
(embed_url
, url
)
1391 def _real_extract(self
, url
):
1392 video_id
= self
._match
_id
(url
)
1393 url
, _
, headers
= self
._unsmuggle
_headers
(url
)
1394 webpage
= self
._download
_webpage
(url
, video_id
, headers
=headers
)
1395 config_url
= self
._parse
_json
(self
._search
_regex
(
1396 r
'window\.OTTData\s*=\s*({.+})', webpage
,
1397 'ott data'), video_id
, js_to_json
)['config_url']
1398 config
= self
._download
_json
(config_url
, video_id
)
1399 info
= self
._parse
_config
(config
, video_id
)
1400 info
['id'] = video_id
1401 self
._vimeo
_sort
_formats
(info
['formats'])