2 from __future__ import unicode_literals
8 from .common import InfoExtractor
32 class VimeoBaseInfoExtractor(InfoExtractor):
33 _NETRC_MACHINE = 'vimeo'
34 _LOGIN_REQUIRED = False
35 _LOGIN_URL = 'https://vimeo.com/log_in'
38 (username, password) = self._get_login_info()
40 if self._LOGIN_REQUIRED:
41 raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True)
44 webpage = self._download_webpage(self._LOGIN_URL, None, False)
45 token, vuid = self._extract_xsrft_and_vuid(webpage)
46 data = urlencode_postdata({
53 login_request = sanitized_Request(self._LOGIN_URL, data)
54 login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
55 login_request.add_header('Referer', self._LOGIN_URL)
56 self._set_vimeo_cookie('vuid', vuid)
57 self._download_webpage(login_request, None, False, 'Wrong login info')
59 def _extract_xsrft_and_vuid(self, webpage):
60 xsrft = self._search_regex(
61 r'(?:(?P<q1>["\'])xsrft(?P=q1)\s*:|xsrft\s*[=:])\s*(?P<q>["\'])(?P<xsrft>.+?)(?P=q)',
62 webpage, 'login token', group='xsrft')
63 vuid = self._search_regex(
64 r'["\']vuid["\']\s*:\s*(["\'])(?P<vuid>.+?)\1',
65 webpage, 'vuid', group='vuid')
68 def _set_vimeo_cookie(self, name, value):
69 self._set_cookie('vimeo.com', name, value)
71 def _vimeo_sort_formats(self, formats):
72 # Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
73 # at the same time without actual units specified. This lead to wrong sorting.
74 self._sort_formats(formats, field_preference=('preference', 'height', 'width', 'fps', 'format_id'))
76 def _parse_config(self, config, video_id):
78 video_title = config['video']['title']
80 # Extract uploader, uploader_url and uploader_id
81 video_uploader = config['video'].get('owner', {}).get('name')
82 video_uploader_url = config['video'].get('owner', {}).get('url')
83 video_uploader_id = video_uploader_url.split('/')[-1] if video_uploader_url else None
85 # Extract video thumbnail
86 video_thumbnail = config['video'].get('thumbnail')
87 if video_thumbnail is None:
88 video_thumbs = config['video'].get('thumbs')
89 if video_thumbs and isinstance(video_thumbs, dict):
90 _, video_thumbnail = sorted((int(width if width.isdigit() else 0), t_url) for (width, t_url) in video_thumbs.items())[-1]
92 # Extract video duration
93 video_duration = int_or_none(config['video'].get('duration'))
96 config_files = config['video'].get('files') or config['request'].get('files', {})
97 for f in config_files.get('progressive', []):
98 video_url = f.get('url')
103 'format_id': 'http-%s' % f.get('quality'),
104 'width': int_or_none(f.get('width')),
105 'height': int_or_none(f.get('height')),
106 'fps': int_or_none(f.get('fps')),
107 'tbr': int_or_none(f.get('bitrate')),
109 m3u8_url = config_files.get('hls', {}).get('url')
111 formats.extend(self._extract_m3u8_formats(
112 m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
115 text_tracks = config['request'].get('text_tracks')
117 for tt in text_tracks:
118 subtitles[tt['lang']] = [{
120 'url': 'https://vimeo.com' + tt['url'],
124 'title': video_title,
125 'uploader': video_uploader,
126 'uploader_id': video_uploader_id,
127 'uploader_url': video_uploader_url,
128 'thumbnail': video_thumbnail,
129 'duration': video_duration,
131 'subtitles': subtitles,
135 class VimeoIE(VimeoBaseInfoExtractor):
136 """Information extractor for vimeo.com."""
138 # _VALID_URL matches Vimeo URLs
139 _VALID_URL = r'''(?x)
148 vimeo(?P<pro>pro)?\.com/
149 (?!channels/[^/?#]+/?(?:$|[?#])|[^/]+/review/|(?:album|ondemand)/)
154 moogaloop\.swf)\?clip_id=
159 /?(?:[?&].*)?(?:[#].*)?$
164 'url': 'http://vimeo.com/56015672#at=0',
165 'md5': '8879b6cc097e987f02484baf890129e5',
169 'title': "youtube-dl test video - \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
170 'description': 'md5:2d3305bad981a06ff79f027f19865021',
171 'upload_date': '20121220',
172 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/user7108434',
173 'uploader_id': 'user7108434',
174 'uploader': 'Filippo Valsorda',
179 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
180 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
181 'note': 'Vimeo Pro video (#1197)',
185 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/openstreetmapus',
186 'uploader_id': 'openstreetmapus',
187 'uploader': 'OpenStreetMap US',
188 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
189 'description': 'md5:fd69a7b8d8c34a4e1d2ec2e4afd6ec30',
194 'url': 'http://player.vimeo.com/video/54469442',
195 'md5': '619b811a4417aa4abe78dc653becf511',
196 'note': 'Videos that embed the url in the player page',
200 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
201 'uploader': 'The BLN & Business of Software',
202 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/theblnbusinessofsoftware',
203 'uploader_id': 'theblnbusinessofsoftware',
209 'url': 'http://vimeo.com/68375962',
210 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
211 'note': 'Video protected with password',
215 'title': 'youtube-dl password protected test video',
216 'upload_date': '20130614',
217 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/user18948128',
218 'uploader_id': 'user18948128',
219 'uploader': 'Jaime Marquínez Ferrándiz',
221 'description': 'This is "youtube-dl password protected test video" by on Vimeo, the home for high quality videos and the people who love them.',
224 'videopassword': 'youtube-dl',
228 'url': 'http://vimeo.com/channels/keypeele/75629013',
229 'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
233 'title': 'Key & Peele: Terrorist Interrogation',
234 'description': 'md5:8678b246399b070816b12313e8b4eb5c',
235 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/atencio',
236 'uploader_id': 'atencio',
237 'uploader': 'Peter Atencio',
238 'upload_date': '20130927',
243 'url': 'http://vimeo.com/76979871',
244 'note': 'Video with subtitles',
248 'title': 'The New Vimeo Player (You Know, For Videos)',
249 'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
250 'upload_date': '20131015',
251 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/staff',
252 'uploader_id': 'staff',
253 'uploader': 'Vimeo Staff',
258 # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/
259 'url': 'https://player.vimeo.com/video/98044508',
260 'note': 'The js code contains assignments to the same variable as the config',
264 'title': 'Pier Solar OUYA Official Trailer',
265 'uploader': 'Tulio Gonçalves',
266 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/user28849593',
267 'uploader_id': 'user28849593',
271 # contains original format
272 'url': 'https://vimeo.com/33951933',
273 'md5': '2d9f5475e0537f013d0073e812ab89e6',
277 'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute',
278 'uploader': 'The DMCI',
279 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/dmci',
280 'uploader_id': 'dmci',
281 'upload_date': '20111220',
282 'description': 'md5:ae23671e82d05415868f7ad1aec21147',
286 # only available via https://vimeo.com/channels/tributes/6213729 and
287 # not via https://vimeo.com/6213729
288 'url': 'https://vimeo.com/channels/tributes/6213729',
292 'title': 'Vimeo Tribute: The Shining',
293 'uploader': 'Casey Donahue',
294 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/caseydonahue',
295 'uploader_id': 'caseydonahue',
296 'upload_date': '20090821',
297 'description': 'md5:bdbf314014e58713e6e5b66eb252f4a6',
300 'skip_download': True,
302 'expected_warnings': ['Unable to download JSON metadata'],
305 'url': 'http://vimeo.com/moogaloop.swf?clip_id=2539741',
306 'only_matching': True,
309 'url': 'https://vimeo.com/109815029',
310 'note': 'Video not completely processed, "failed" seed status',
311 'only_matching': True,
314 'url': 'https://vimeo.com/groups/travelhd/videos/22439234',
315 'only_matching': True,
318 # source file returns 403: Forbidden
319 'url': 'https://vimeo.com/7809605',
320 'only_matching': True,
323 'url': 'https://vimeo.com/160743502/abd0e13fb4',
324 'only_matching': True,
329 def _extract_vimeo_url(url, webpage):
330 # Look for embedded (iframe) Vimeo player
332 r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//player\.vimeo\.com/video/.+?)\1', webpage)
334 player_url = unescapeHTML(mobj.group('url'))
335 surl = smuggle_url(player_url, {'http_headers': {'Referer': url}})
337 # Look for embedded (swf embed) Vimeo player
339 r'<embed[^>]+?src="((?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)"', webpage)
343 def _verify_video_password(self, url, video_id, webpage):
344 password = self._downloader.params.get('videopassword')
346 raise ExtractorError('This video is protected by a password, use the --video-password option', expected=True)
347 token, vuid = self._extract_xsrft_and_vuid(webpage)
348 data = urlencode_postdata({
349 'password': password,
352 if url.startswith('http://'):
353 # vimeo only supports https now, but the user can give an http url
354 url = url.replace('http://', 'https://')
355 password_request = sanitized_Request(url + '/password', data)
356 password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
357 password_request.add_header('Referer', url)
358 self._set_vimeo_cookie('vuid', vuid)
359 return self._download_webpage(
360 password_request, video_id,
361 'Verifying the password', 'Wrong password')
363 def _verify_player_video_password(self, url, video_id):
364 password = self._downloader.params.get('videopassword')
366 raise ExtractorError('This video is protected by a password, use the --video-password option')
367 data = urlencode_postdata({'password': password})
368 pass_url = url + '/check-password'
369 password_request = sanitized_Request(pass_url, data)
370 password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
371 password_request.add_header('Referer', url)
372 return self._download_json(
373 password_request, video_id,
374 'Verifying the password', 'Wrong password')
376 def _real_initialize(self):
379 def _real_extract(self, url):
380 url, data = unsmuggle_url(url, {})
381 headers = std_headers.copy()
382 if 'http_headers' in data:
383 headers.update(data['http_headers'])
384 if 'Referer' not in headers:
385 headers['Referer'] = url
387 # Extract ID from URL
388 mobj = re.match(self._VALID_URL, url)
389 video_id = mobj.group('id')
391 if mobj.group('pro') or mobj.group('player'):
392 url = 'https://player.vimeo.com/video/' + video_id
393 elif any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')):
394 url = 'https://vimeo.com/' + video_id
396 # Retrieve video webpage to extract further information
397 request = sanitized_Request(url, headers=headers)
399 webpage = self._download_webpage(request, video_id)
400 except ExtractorError as ee:
401 if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
402 errmsg = ee.cause.read()
403 if b'Because of its privacy settings, this video cannot be played here' in errmsg:
404 raise ExtractorError(
405 'Cannot download embed-only video without embedding '
406 'URL. Please call youtube-dl with the URL of the page '
407 'that embeds this video.',
411 # Now we begin extracting as much information as we can from what we
412 # retrieved. First we extract the information common to all extractors,
413 # and latter we extract those that are Vimeo specific.
414 self.report_extraction(video_id)
416 vimeo_config = self._search_regex(
417 r'vimeo\.config\s*=\s*(?:({.+?})|_extend\([^,]+,\s+({.+?})\));', webpage,
418 'vimeo config', default=None)
420 seed_status = self._parse_json(vimeo_config, video_id).get('seed_status', {})
421 if seed_status.get('state') == 'failed':
422 raise ExtractorError(
423 '%s said: %s' % (self.IE_NAME, seed_status['title']),
426 # Extract the config JSON
429 config_url = self._html_search_regex(
430 r' data-config-url="(.+?)"', webpage,
431 'config URL', default=None)
433 # Sometimes new react-based page is served instead of old one that require
434 # different config URL extraction approach (see
435 # https://github.com/rg3/youtube-dl/pull/7209)
436 vimeo_clip_page_config = self._search_regex(
437 r'vimeo\.clip_page_config\s*=\s*({.+?});', webpage,
438 'vimeo clip page config')
439 config_url = self._parse_json(
440 vimeo_clip_page_config, video_id)['player']['config_url']
441 config_json = self._download_webpage(config_url, video_id)
442 config = json.loads(config_json)
443 except RegexNotFoundError:
444 # For pro videos or player.vimeo.com urls
445 # We try to find out to which variable is assigned the config dic
446 m_variable_name = re.search('(\w)\.video\.id', webpage)
447 if m_variable_name is not None:
448 config_re = r'%s=({[^}].+?});' % re.escape(m_variable_name.group(1))
450 config_re = [r' = {config:({.+?}),assets:', r'(?:[abc])=({.+?});']
451 config = self._search_regex(config_re, webpage, 'info section',
453 config = json.loads(config)
454 except Exception as e:
455 if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage):
456 raise ExtractorError('The author has restricted the access to this video, try with the "--referer" option')
458 if re.search(r'<form[^>]+?id="pw_form"', webpage) is not None:
459 if '_video_password_verified' in data:
460 raise ExtractorError('video password verification failed!')
461 self._verify_video_password(url, video_id, webpage)
462 return self._real_extract(
463 smuggle_url(url, {'_video_password_verified': 'verified'}))
465 raise ExtractorError('Unable to extract info section',
468 if config.get('view') == 4:
469 config = self._verify_player_video_password(url, video_id)
472 if '>You rented this title.<' in webpage:
474 if config.get('user', {}).get('purchased'):
477 config, lambda x: x['video']['vod']['purchase_options'][0]['label_string'], compat_str)
478 if label and label.startswith('You rented this'):
483 feature_id = config.get('video', {}).get('vod', {}).get('feature_id')
484 if feature_id and not data.get('force_feature_id', False):
485 return self.url_result(smuggle_url(
486 'https://player.vimeo.com/player/%s' % feature_id,
487 {'force_feature_id': True}), 'Vimeo')
489 # Extract video description
491 video_description = self._html_search_regex(
492 r'(?s)<div\s+class="[^"]*description[^"]*"[^>]*>(.*?)</div>',
493 webpage, 'description', default=None)
494 if not video_description:
495 video_description = self._html_search_meta(
496 'description', webpage, default=None)
497 if not video_description and mobj.group('pro'):
498 orig_webpage = self._download_webpage(
500 note='Downloading webpage for description',
503 video_description = self._html_search_meta(
504 'description', orig_webpage, default=None)
505 if not video_description and not mobj.group('player'):
506 self._downloader.report_warning('Cannot find video description')
508 # Extract upload date
509 video_upload_date = None
510 mobj = re.search(r'<time[^>]+datetime="([^"]+)"', webpage)
512 video_upload_date = unified_strdate(mobj.group(1))
515 view_count = int(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count'))
516 like_count = int(self._search_regex(r'UserLikes:(\d+)', webpage, 'like count'))
517 comment_count = int(self._search_regex(r'UserComments:(\d+)', webpage, 'comment count'))
518 except RegexNotFoundError:
519 # This info is only available in vimeo.com/{id} urls
525 download_request = sanitized_Request('https://vimeo.com/%s?action=load_download_config' % video_id, headers={
526 'X-Requested-With': 'XMLHttpRequest'})
527 download_data = self._download_json(download_request, video_id, fatal=False)
529 source_file = download_data.get('source_file')
530 if isinstance(source_file, dict):
531 download_url = source_file.get('download_url')
532 if download_url and not source_file.get('is_cold') and not source_file.get('is_defrosting'):
533 source_name = source_file.get('public_name', 'Original')
534 if self._is_valid_url(download_url, video_id, '%s video' % source_name):
535 ext = source_file.get('extension', determine_ext(download_url)).lower()
539 'width': int_or_none(source_file.get('width')),
540 'height': int_or_none(source_file.get('height')),
541 'filesize': parse_filesize(source_file.get('size')),
542 'format_id': source_name,
546 info_dict = self._parse_config(config, video_id)
547 formats.extend(info_dict['formats'])
548 self._vimeo_sort_formats(formats)
552 'upload_date': video_upload_date,
553 'description': video_description,
555 'view_count': view_count,
556 'like_count': like_count,
557 'comment_count': comment_count,
563 class VimeoOndemandIE(VimeoBaseInfoExtractor):
564 IE_NAME = 'vimeo:ondemand'
565 _VALID_URL = r'https?://(?:www\.)?vimeo\.com/ondemand/(?P<id>[^/?#&]+)'
567 # ondemand video not available via https://vimeo.com/id
568 'url': 'https://vimeo.com/ondemand/20704',
569 'md5': 'c424deda8c7f73c1dfb3edd7630e2f35',
573 'title': 'המעבדה - במאי יותם פלדמן',
574 'uploader': 'גם סרטים',
575 'uploader_url': 're:https?://(?:www\.)?vimeo\.com/gumfilms',
576 'uploader_id': 'gumfilms',
579 'url': 'https://vimeo.com/ondemand/nazmaalik',
580 'only_matching': True,
582 'url': 'https://vimeo.com/ondemand/141692381',
583 'only_matching': True,
585 'url': 'https://vimeo.com/ondemand/thelastcolony/150274832',
586 'only_matching': True,
589 def _real_extract(self, url):
590 video_id = self._match_id(url)
591 webpage = self._download_webpage(url, video_id)
592 return self.url_result(self._og_search_video_url(webpage), VimeoIE.ie_key())
595 class VimeoChannelIE(VimeoBaseInfoExtractor):
596 IE_NAME = 'vimeo:channel'
597 _VALID_URL = r'https://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
598 _MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
600 _TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
602 'url': 'https://vimeo.com/channels/tributes',
605 'title': 'Vimeo Tributes',
607 'playlist_mincount': 25,
610 def _page_url(self, base_url, pagenum):
611 return '%s/videos/page:%d/' % (base_url, pagenum)
613 def _extract_list_title(self, webpage):
614 return self._TITLE or self._html_search_regex(self._TITLE_RE, webpage, 'list title')
616 def _login_list_password(self, page_url, list_id, webpage):
617 login_form = self._search_regex(
618 r'(?s)<form[^>]+?id="pw_form"(.*?)</form>',
619 webpage, 'login form', default=None)
623 password = self._downloader.params.get('videopassword')
625 raise ExtractorError('This album is protected by a password, use the --video-password option', expected=True)
626 fields = self._hidden_inputs(login_form)
627 token, vuid = self._extract_xsrft_and_vuid(webpage)
628 fields['token'] = token
629 fields['password'] = password
630 post = urlencode_postdata(fields)
631 password_path = self._search_regex(
632 r'action="([^"]+)"', login_form, 'password URL')
633 password_url = compat_urlparse.urljoin(page_url, password_path)
634 password_request = sanitized_Request(password_url, post)
635 password_request.add_header('Content-type', 'application/x-www-form-urlencoded')
636 self._set_vimeo_cookie('vuid', vuid)
637 self._set_vimeo_cookie('xsrft', token)
639 return self._download_webpage(
640 password_request, list_id,
641 'Verifying the password', 'Wrong password')
643 def _title_and_entries(self, list_id, base_url):
644 for pagenum in itertools.count(1):
645 page_url = self._page_url(base_url, pagenum)
646 webpage = self._download_webpage(
648 'Downloading page %s' % pagenum)
651 webpage = self._login_list_password(page_url, list_id, webpage)
652 yield self._extract_list_title(webpage)
654 for video_id in re.findall(r'id="clip_(\d+?)"', webpage):
655 yield self.url_result('https://vimeo.com/%s' % video_id, 'Vimeo')
657 if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
660 def _extract_videos(self, list_id, base_url):
661 title_and_entries = self._title_and_entries(list_id, base_url)
662 list_title = next(title_and_entries)
663 return self.playlist_result(title_and_entries, list_id, list_title)
665 def _real_extract(self, url):
666 mobj = re.match(self._VALID_URL, url)
667 channel_id = mobj.group('id')
668 return self._extract_videos(channel_id, 'https://vimeo.com/channels/%s' % channel_id)
671 class VimeoUserIE(VimeoChannelIE):
672 IE_NAME = 'vimeo:user'
673 _VALID_URL = r'https://vimeo\.com/(?!(?:[0-9]+|watchlater)(?:$|[?#/]))(?P<name>[^/]+)(?:/videos|[#?]|$)'
674 _TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
676 'url': 'https://vimeo.com/nkistudio/videos',
681 'playlist_mincount': 66,
684 def _real_extract(self, url):
685 mobj = re.match(self._VALID_URL, url)
686 name = mobj.group('name')
687 return self._extract_videos(name, 'https://vimeo.com/%s' % name)
690 class VimeoAlbumIE(VimeoChannelIE):
691 IE_NAME = 'vimeo:album'
692 _VALID_URL = r'https://vimeo\.com/album/(?P<id>\d+)'
693 _TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
695 'url': 'https://vimeo.com/album/2632481',
698 'title': 'Staff Favorites: November 2013',
700 'playlist_mincount': 13,
702 'note': 'Password-protected album',
703 'url': 'https://vimeo.com/album/3253534',
710 'videopassword': 'youtube-dl',
714 def _page_url(self, base_url, pagenum):
715 return '%s/page:%d/' % (base_url, pagenum)
717 def _real_extract(self, url):
718 album_id = self._match_id(url)
719 return self._extract_videos(album_id, 'https://vimeo.com/album/%s' % album_id)
722 class VimeoGroupsIE(VimeoAlbumIE):
723 IE_NAME = 'vimeo:group'
724 _VALID_URL = r'https://vimeo\.com/groups/(?P<name>[^/]+)(?:/(?!videos?/\d+)|$)'
726 'url': 'https://vimeo.com/groups/rolexawards',
729 'title': 'Rolex Awards for Enterprise',
731 'playlist_mincount': 73,
734 def _extract_list_title(self, webpage):
735 return self._og_search_title(webpage)
737 def _real_extract(self, url):
738 mobj = re.match(self._VALID_URL, url)
739 name = mobj.group('name')
740 return self._extract_videos(name, 'https://vimeo.com/groups/%s' % name)
743 class VimeoReviewIE(VimeoBaseInfoExtractor):
744 IE_NAME = 'vimeo:review'
745 IE_DESC = 'Review pages on vimeo'
746 _VALID_URL = r'https://vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
748 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
749 'md5': 'c507a72f780cacc12b2248bb4006d253',
753 'title': "DICK HARDWICK 'Comedian'",
754 'uploader': 'Richard Hardwick',
755 'uploader_id': 'user21297594',
758 'note': 'video player needs Referer',
759 'url': 'https://vimeo.com/user22258446/review/91613211/13f927e053',
760 'md5': '6295fdab8f4bf6a002d058b2c6dce276',
764 'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn',
765 'uploader': 'DevWeek Events',
767 'thumbnail': 're:^https?://.*\.jpg$',
768 'uploader_id': 'user22258446',
772 def _real_extract(self, url):
773 video_id = self._match_id(url)
774 config = self._download_json(
775 'https://player.vimeo.com/video/%s/config' % video_id, video_id)
776 info_dict = self._parse_config(config, video_id)
777 self._vimeo_sort_formats(info_dict['formats'])
778 info_dict['id'] = video_id
782 class VimeoWatchLaterIE(VimeoChannelIE):
783 IE_NAME = 'vimeo:watchlater'
784 IE_DESC = 'Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)'
785 _VALID_URL = r'https://vimeo\.com/(?:home/)?watchlater|:vimeowatchlater'
786 _TITLE = 'Watch Later'
787 _LOGIN_REQUIRED = True
789 'url': 'https://vimeo.com/watchlater',
790 'only_matching': True,
793 def _real_initialize(self):
796 def _page_url(self, base_url, pagenum):
797 url = '%s/page:%d/' % (base_url, pagenum)
798 request = sanitized_Request(url)
799 # Set the header to get a partial html page with the ids,
800 # the normal page doesn't contain them.
801 request.add_header('X-Requested-With', 'XMLHttpRequest')
804 def _real_extract(self, url):
805 return self._extract_videos('watchlater', 'https://vimeo.com/watchlater')
808 class VimeoLikesIE(InfoExtractor):
809 _VALID_URL = r'https://(?:www\.)?vimeo\.com/user(?P<id>[0-9]+)/likes/?(?:$|[?#]|sort:)'
810 IE_NAME = 'vimeo:likes'
811 IE_DESC = 'Vimeo user likes'
813 'url': 'https://vimeo.com/user755559/likes/',
814 'playlist_mincount': 293,
816 'id': 'user755559_likes',
817 'description': 'See all the videos urza likes',
818 'title': 'Videos urza likes',
822 def _real_extract(self, url):
823 user_id = self._match_id(url)
824 webpage = self._download_webpage(url, user_id)
825 page_count = self._int(
827 r'''(?x)<li><a\s+href="[^"]+"\s+data-page="([0-9]+)">
828 .*?</a></li>\s*<li\s+class="pagination_next">
829 ''', webpage, 'page count'),
830 'page count', fatal=True)
832 title = self._html_search_regex(
833 r'(?s)<h1>(.+?)</h1>', webpage, 'title', fatal=False)
834 description = self._html_search_meta('description', webpage)
837 page_url = 'https://vimeo.com/user%s/likes/page:%d/sort:date' % (
839 webpage = self._download_webpage(
841 note='Downloading page %d/%d' % (idx + 1, page_count))
842 video_list = self._search_regex(
843 r'(?s)<ol class="js-browse_list[^"]+"[^>]*>(.*?)</ol>',
844 webpage, 'video content')
846 r'<li[^>]*>\s*<a\s+href="([^"]+)"', video_list)
850 'url': compat_urlparse.urljoin(page_url, path),
853 pl = InAdvancePagedList(_get_page, page_count, PAGE_SIZE)
857 'id': 'user%s_likes' % user_id,
859 'description': description,