[vimeo] Prevent infinite loops if video password verification fails
[youtube-dl] / youtube_dl / extractor / vimeo.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
4 import json
5 import re
6 import itertools
7
8 from .common import InfoExtractor
9 from .subtitles import SubtitlesInfoExtractor
10 from ..compat import (
11     compat_HTTPError,
12     compat_urllib_parse,
13     compat_urllib_request,
14     compat_urlparse,
15 )
16 from ..utils import (
17     ExtractorError,
18     InAdvancePagedList,
19     int_or_none,
20     RegexNotFoundError,
21     smuggle_url,
22     std_headers,
23     unsmuggle_url,
24     urlencode_postdata,
25 )
26
27
28 class VimeoBaseInfoExtractor(InfoExtractor):
29     _NETRC_MACHINE = 'vimeo'
30     _LOGIN_REQUIRED = False
31
32     def _login(self):
33         (username, password) = self._get_login_info()
34         if username is None:
35             if self._LOGIN_REQUIRED:
36                 raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True)
37             return
38         self.report_login()
39         login_url = 'https://vimeo.com/log_in'
40         webpage = self._download_webpage(login_url, None, False)
41         token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
42         data = urlencode_postdata({
43             'email': username,
44             'password': password,
45             'action': 'login',
46             'service': 'vimeo',
47             'token': token,
48         })
49         login_request = compat_urllib_request.Request(login_url, data)
50         login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
51         login_request.add_header('Cookie', 'xsrft=%s' % token)
52         self._download_webpage(login_request, None, False, 'Wrong login info')
53
54
55 class VimeoIE(VimeoBaseInfoExtractor, SubtitlesInfoExtractor):
56     """Information extractor for vimeo.com."""
57
58     # _VALID_URL matches Vimeo URLs
59     _VALID_URL = r'''(?x)
60         https?://
61         (?:(?:www|(?P<player>player))\.)?
62         vimeo(?P<pro>pro)?\.com/
63         (?!channels/[^/?#]+/?(?:$|[?#])|album/)
64         (?:.*?/)?
65         (?:(?:play_redirect_hls|moogaloop\.swf)\?clip_id=)?
66         (?:videos?/)?
67         (?P<id>[0-9]+)
68         /?(?:[?&].*)?(?:[#].*)?$'''
69     IE_NAME = 'vimeo'
70     _TESTS = [
71         {
72             'url': 'http://vimeo.com/56015672#at=0',
73             'md5': '8879b6cc097e987f02484baf890129e5',
74             'info_dict': {
75                 'id': '56015672',
76                 'ext': 'mp4',
77                 "upload_date": "20121220",
78                 "description": "This is a test case for youtube-dl.\nFor more information, see github.com/rg3/youtube-dl\nTest chars: \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
79                 "uploader_id": "user7108434",
80                 "uploader": "Filippo Valsorda",
81                 "title": "youtube-dl test video - \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
82                 "duration": 10,
83             },
84         },
85         {
86             'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
87             'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
88             'note': 'Vimeo Pro video (#1197)',
89             'info_dict': {
90                 'id': '68093876',
91                 'ext': 'mp4',
92                 'uploader_id': 'openstreetmapus',
93                 'uploader': 'OpenStreetMap US',
94                 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
95                 'description': 'md5:380943ec71b89736ff4bf27183233d09',
96                 'duration': 1595,
97             },
98         },
99         {
100             'url': 'http://player.vimeo.com/video/54469442',
101             'md5': '619b811a4417aa4abe78dc653becf511',
102             'note': 'Videos that embed the url in the player page',
103             'info_dict': {
104                 'id': '54469442',
105                 'ext': 'mp4',
106                 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
107                 'uploader': 'The BLN & Business of Software',
108                 'uploader_id': 'theblnbusinessofsoftware',
109                 'duration': 3610,
110                 'description': None,
111             },
112         },
113         {
114             'url': 'http://vimeo.com/68375962',
115             'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
116             'note': 'Video protected with password',
117             'info_dict': {
118                 'id': '68375962',
119                 'ext': 'mp4',
120                 'title': 'youtube-dl password protected test video',
121                 'upload_date': '20130614',
122                 'uploader_id': 'user18948128',
123                 'uploader': 'Jaime Marquínez Ferrándiz',
124                 'duration': 10,
125                 'description': 'This is "youtube-dl password protected test video" by Jaime Marquínez Ferrándiz on Vimeo, the home for high quality videos and the people who love them.',
126             },
127             'params': {
128                 'videopassword': 'youtube-dl',
129             },
130         },
131         {
132             'url': 'http://vimeo.com/channels/keypeele/75629013',
133             'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
134             'note': 'Video is freely available via original URL '
135                     'and protected with password when accessed via http://vimeo.com/75629013',
136             'info_dict': {
137                 'id': '75629013',
138                 'ext': 'mp4',
139                 'title': 'Key & Peele: Terrorist Interrogation',
140                 'description': 'md5:8678b246399b070816b12313e8b4eb5c',
141                 'uploader_id': 'atencio',
142                 'uploader': 'Peter Atencio',
143                 'duration': 187,
144             },
145         },
146         {
147             'url': 'http://vimeo.com/76979871',
148             'md5': '3363dd6ffebe3784d56f4132317fd446',
149             'note': 'Video with subtitles',
150             'info_dict': {
151                 'id': '76979871',
152                 'ext': 'mp4',
153                 'title': 'The New Vimeo Player (You Know, For Videos)',
154                 'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
155                 'upload_date': '20131015',
156                 'uploader_id': 'staff',
157                 'uploader': 'Vimeo Staff',
158                 'duration': 62,
159             }
160         },
161         {
162             # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/
163             'url': 'https://player.vimeo.com/video/98044508',
164             'note': 'The js code contains assignments to the same variable as the config',
165             'info_dict': {
166                 'id': '98044508',
167                 'ext': 'mp4',
168                 'title': 'Pier Solar OUYA Official Trailer',
169                 'uploader': 'Tulio Gonçalves',
170                 'uploader_id': 'user28849593',
171             },
172         },
173     ]
174
175     def _verify_video_password(self, url, video_id, webpage):
176         password = self._downloader.params.get('videopassword', None)
177         if password is None:
178             raise ExtractorError('This video is protected by a password, use the --video-password option')
179         token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
180         data = compat_urllib_parse.urlencode({
181             'password': password,
182             'token': token,
183         })
184         # I didn't manage to use the password with https
185         if url.startswith('https'):
186             pass_url = url.replace('https', 'http')
187         else:
188             pass_url = url
189         password_request = compat_urllib_request.Request(pass_url + '/password', data)
190         password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
191         password_request.add_header('Cookie', 'xsrft=%s' % token)
192         return self._download_webpage(
193             password_request, video_id,
194             'Verifying the password', 'Wrong password')
195
196     def _verify_player_video_password(self, url, video_id):
197         password = self._downloader.params.get('videopassword', None)
198         if password is None:
199             raise ExtractorError('This video is protected by a password, use the --video-password option')
200         data = compat_urllib_parse.urlencode({'password': password})
201         pass_url = url + '/check-password'
202         password_request = compat_urllib_request.Request(pass_url, data)
203         password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
204         return self._download_json(
205             password_request, video_id,
206             'Verifying the password',
207             'Wrong password')
208
209     def _real_initialize(self):
210         self._login()
211
212     def _real_extract(self, url):
213         url, data = unsmuggle_url(url)
214         headers = std_headers
215         if data is not None:
216             headers = headers.copy()
217             headers.update(data)
218         if 'Referer' not in headers:
219             headers['Referer'] = url
220
221         # Extract ID from URL
222         mobj = re.match(self._VALID_URL, url)
223         video_id = mobj.group('id')
224         orig_url = url
225         if mobj.group('pro') or mobj.group('player'):
226             url = 'http://player.vimeo.com/video/' + video_id
227
228         # Retrieve video webpage to extract further information
229         request = compat_urllib_request.Request(url, None, headers)
230         try:
231             webpage = self._download_webpage(request, video_id)
232         except ExtractorError as ee:
233             if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
234                 errmsg = ee.cause.read()
235                 if b'Because of its privacy settings, this video cannot be played here' in errmsg:
236                     raise ExtractorError(
237                         'Cannot download embed-only video without embedding '
238                         'URL. Please call youtube-dl with the URL of the page '
239                         'that embeds this video.',
240                         expected=True)
241             raise
242
243         # Now we begin extracting as much information as we can from what we
244         # retrieved. First we extract the information common to all extractors,
245         # and latter we extract those that are Vimeo specific.
246         self.report_extraction(video_id)
247
248         # Extract the config JSON
249         try:
250             try:
251                 config_url = self._html_search_regex(
252                     r' data-config-url="(.+?)"', webpage, 'config URL')
253                 config_json = self._download_webpage(config_url, video_id)
254                 config = json.loads(config_json)
255             except RegexNotFoundError:
256                 # For pro videos or player.vimeo.com urls
257                 # We try to find out to which variable is assigned the config dic
258                 m_variable_name = re.search('(\w)\.video\.id', webpage)
259                 if m_variable_name is not None:
260                     config_re = r'%s=({[^}].+?});' % re.escape(m_variable_name.group(1))
261                 else:
262                     config_re = [r' = {config:({.+?}),assets:', r'(?:[abc])=({.+?});']
263                 config = self._search_regex(config_re, webpage, 'info section',
264                                             flags=re.DOTALL)
265                 config = json.loads(config)
266         except Exception as e:
267             if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage):
268                 raise ExtractorError('The author has restricted the access to this video, try with the "--referer" option')
269
270             if re.search(r'<form[^>]+?id="pw_form"', webpage) is not None:
271                 if data and '_video_password_verified' in data:
272                     raise ExtractorError('video password verification failed!')
273                 self._verify_video_password(url, video_id, webpage)
274                 return self._real_extract(
275                     smuggle_url(url, {'_video_password_verified': 'verified'}))
276             else:
277                 raise ExtractorError('Unable to extract info section',
278                                      cause=e)
279         else:
280             if config.get('view') == 4:
281                 config = self._verify_player_video_password(url, video_id)
282
283         # Extract title
284         video_title = config["video"]["title"]
285
286         # Extract uploader and uploader_id
287         video_uploader = config["video"]["owner"]["name"]
288         video_uploader_id = config["video"]["owner"]["url"].split('/')[-1] if config["video"]["owner"]["url"] else None
289
290         # Extract video thumbnail
291         video_thumbnail = config["video"].get("thumbnail")
292         if video_thumbnail is None:
293             video_thumbs = config["video"].get("thumbs")
294             if video_thumbs and isinstance(video_thumbs, dict):
295                 _, video_thumbnail = sorted((int(width if width.isdigit() else 0), t_url) for (width, t_url) in video_thumbs.items())[-1]
296
297         # Extract video description
298
299         video_description = self._html_search_regex(
300             r'(?s)<div\s+class="[^"]*description[^"]*"[^>]*>(.*?)</div>',
301             webpage, 'description', default=None)
302         if not video_description:
303             video_description = self._html_search_meta(
304                 'description', webpage, default=None)
305         if not video_description and mobj.group('pro'):
306             orig_webpage = self._download_webpage(
307                 orig_url, video_id,
308                 note='Downloading webpage for description',
309                 fatal=False)
310             if orig_webpage:
311                 video_description = self._html_search_meta(
312                     'description', orig_webpage, default=None)
313         if not video_description and not mobj.group('player'):
314             self._downloader.report_warning('Cannot find video description')
315
316         # Extract video duration
317         video_duration = int_or_none(config["video"].get("duration"))
318
319         # Extract upload date
320         video_upload_date = None
321         mobj = re.search(r'<meta itemprop="dateCreated" content="(\d{4})-(\d{2})-(\d{2})T', webpage)
322         if mobj is not None:
323             video_upload_date = mobj.group(1) + mobj.group(2) + mobj.group(3)
324
325         try:
326             view_count = int(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count'))
327             like_count = int(self._search_regex(r'UserLikes:(\d+)', webpage, 'like count'))
328             comment_count = int(self._search_regex(r'UserComments:(\d+)', webpage, 'comment count'))
329         except RegexNotFoundError:
330             # This info is only available in vimeo.com/{id} urls
331             view_count = None
332             like_count = None
333             comment_count = None
334
335         # Vimeo specific: extract request signature and timestamp
336         sig = config['request']['signature']
337         timestamp = config['request']['timestamp']
338
339         # Vimeo specific: extract video codec and quality information
340         # First consider quality, then codecs, then take everything
341         codecs = [('vp6', 'flv'), ('vp8', 'flv'), ('h264', 'mp4')]
342         files = {'hd': [], 'sd': [], 'other': []}
343         config_files = config["video"].get("files") or config["request"].get("files")
344         for codec_name, codec_extension in codecs:
345             for quality in config_files.get(codec_name, []):
346                 format_id = '-'.join((codec_name, quality)).lower()
347                 key = quality if quality in files else 'other'
348                 video_url = None
349                 if isinstance(config_files[codec_name], dict):
350                     file_info = config_files[codec_name][quality]
351                     video_url = file_info.get('url')
352                 else:
353                     file_info = {}
354                 if video_url is None:
355                     video_url = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=%s&type=moogaloop_local&embed_location=" \
356                         % (video_id, sig, timestamp, quality, codec_name.upper())
357
358                 files[key].append({
359                     'ext': codec_extension,
360                     'url': video_url,
361                     'format_id': format_id,
362                     'width': file_info.get('width'),
363                     'height': file_info.get('height'),
364                 })
365         formats = []
366         for key in ('other', 'sd', 'hd'):
367             formats += files[key]
368         if len(formats) == 0:
369             raise ExtractorError('No known codec found')
370
371         subtitles = {}
372         text_tracks = config['request'].get('text_tracks')
373         if text_tracks:
374             for tt in text_tracks:
375                 subtitles[tt['lang']] = 'http://vimeo.com' + tt['url']
376
377         video_subtitles = self.extract_subtitles(video_id, subtitles)
378         if self._downloader.params.get('listsubtitles', False):
379             self._list_available_subtitles(video_id, subtitles)
380             return
381
382         return {
383             'id': video_id,
384             'uploader': video_uploader,
385             'uploader_id': video_uploader_id,
386             'upload_date': video_upload_date,
387             'title': video_title,
388             'thumbnail': video_thumbnail,
389             'description': video_description,
390             'duration': video_duration,
391             'formats': formats,
392             'webpage_url': url,
393             'view_count': view_count,
394             'like_count': like_count,
395             'comment_count': comment_count,
396             'subtitles': video_subtitles,
397         }
398
399
400 class VimeoChannelIE(InfoExtractor):
401     IE_NAME = 'vimeo:channel'
402     _VALID_URL = r'https?://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
403     _MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
404     _TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
405     _TESTS = [{
406         'url': 'http://vimeo.com/channels/tributes',
407         'info_dict': {
408             'title': 'Vimeo Tributes',
409         },
410         'playlist_mincount': 25,
411     }]
412
413     def _page_url(self, base_url, pagenum):
414         return '%s/videos/page:%d/' % (base_url, pagenum)
415
416     def _extract_list_title(self, webpage):
417         return self._html_search_regex(self._TITLE_RE, webpage, 'list title')
418
419     def _login_list_password(self, page_url, list_id, webpage):
420         login_form = self._search_regex(
421             r'(?s)<form[^>]+?id="pw_form"(.*?)</form>',
422             webpage, 'login form', default=None)
423         if not login_form:
424             return webpage
425
426         password = self._downloader.params.get('videopassword', None)
427         if password is None:
428             raise ExtractorError('This album is protected by a password, use the --video-password option', expected=True)
429         fields = dict(re.findall(r'''(?x)<input\s+
430             type="hidden"\s+
431             name="([^"]+)"\s+
432             value="([^"]*)"
433             ''', login_form))
434         token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
435         fields['token'] = token
436         fields['password'] = password
437         post = compat_urllib_parse.urlencode(fields)
438         password_path = self._search_regex(
439             r'action="([^"]+)"', login_form, 'password URL')
440         password_url = compat_urlparse.urljoin(page_url, password_path)
441         password_request = compat_urllib_request.Request(password_url, post)
442         password_request.add_header('Content-type', 'application/x-www-form-urlencoded')
443         self._set_cookie('vimeo.com', 'xsrft', token)
444
445         return self._download_webpage(
446             password_request, list_id,
447             'Verifying the password', 'Wrong password')
448
449     def _extract_videos(self, list_id, base_url):
450         video_ids = []
451         for pagenum in itertools.count(1):
452             page_url = self._page_url(base_url, pagenum)
453             webpage = self._download_webpage(
454                 page_url, list_id,
455                 'Downloading page %s' % pagenum)
456
457             if pagenum == 1:
458                 webpage = self._login_list_password(page_url, list_id, webpage)
459
460             video_ids.extend(re.findall(r'id="clip_(\d+?)"', webpage))
461             if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
462                 break
463
464         entries = [self.url_result('http://vimeo.com/%s' % video_id, 'Vimeo')
465                    for video_id in video_ids]
466         return {'_type': 'playlist',
467                 'id': list_id,
468                 'title': self._extract_list_title(webpage),
469                 'entries': entries,
470                 }
471
472     def _real_extract(self, url):
473         mobj = re.match(self._VALID_URL, url)
474         channel_id = mobj.group('id')
475         return self._extract_videos(channel_id, 'http://vimeo.com/channels/%s' % channel_id)
476
477
478 class VimeoUserIE(VimeoChannelIE):
479     IE_NAME = 'vimeo:user'
480     _VALID_URL = r'https?://vimeo\.com/(?![0-9]+(?:$|[?#/]))(?P<name>[^/]+)(?:/videos|[#?]|$)'
481     _TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
482     _TESTS = [{
483         'url': 'http://vimeo.com/nkistudio/videos',
484         'info_dict': {
485             'title': 'Nki',
486         },
487         'playlist_mincount': 66,
488     }]
489
490     def _real_extract(self, url):
491         mobj = re.match(self._VALID_URL, url)
492         name = mobj.group('name')
493         return self._extract_videos(name, 'http://vimeo.com/%s' % name)
494
495
496 class VimeoAlbumIE(VimeoChannelIE):
497     IE_NAME = 'vimeo:album'
498     _VALID_URL = r'https?://vimeo\.com/album/(?P<id>\d+)'
499     _TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
500     _TESTS = [{
501         'url': 'http://vimeo.com/album/2632481',
502         'info_dict': {
503             'title': 'Staff Favorites: November 2013',
504         },
505         'playlist_mincount': 13,
506     }, {
507         'note': 'Password-protected album',
508         'url': 'https://vimeo.com/album/3253534',
509         'info_dict': {
510             'title': 'test',
511             'id': '3253534',
512         },
513         'playlist_count': 1,
514         'params': {
515             'videopassword': 'youtube-dl',
516         }
517     }]
518
519     def _page_url(self, base_url, pagenum):
520         return '%s/page:%d/' % (base_url, pagenum)
521
522     def _real_extract(self, url):
523         album_id = self._match_id(url)
524         return self._extract_videos(album_id, 'http://vimeo.com/album/%s' % album_id)
525
526
527 class VimeoGroupsIE(VimeoAlbumIE):
528     IE_NAME = 'vimeo:group'
529     _VALID_URL = r'(?:https?://)?vimeo\.com/groups/(?P<name>[^/]+)'
530     _TESTS = [{
531         'url': 'http://vimeo.com/groups/rolexawards',
532         'info_dict': {
533             'title': 'Rolex Awards for Enterprise',
534         },
535         'playlist_mincount': 73,
536     }]
537
538     def _extract_list_title(self, webpage):
539         return self._og_search_title(webpage)
540
541     def _real_extract(self, url):
542         mobj = re.match(self._VALID_URL, url)
543         name = mobj.group('name')
544         return self._extract_videos(name, 'http://vimeo.com/groups/%s' % name)
545
546
547 class VimeoReviewIE(InfoExtractor):
548     IE_NAME = 'vimeo:review'
549     IE_DESC = 'Review pages on vimeo'
550     _VALID_URL = r'https?://vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
551     _TESTS = [{
552         'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
553         'md5': 'c507a72f780cacc12b2248bb4006d253',
554         'info_dict': {
555             'id': '75524534',
556             'ext': 'mp4',
557             'title': "DICK HARDWICK 'Comedian'",
558             'uploader': 'Richard Hardwick',
559         }
560     }, {
561         'note': 'video player needs Referer',
562         'url': 'http://vimeo.com/user22258446/review/91613211/13f927e053',
563         'md5': '6295fdab8f4bf6a002d058b2c6dce276',
564         'info_dict': {
565             'id': '91613211',
566             'ext': 'mp4',
567             'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn',
568             'uploader': 'DevWeek Events',
569             'duration': 2773,
570             'thumbnail': 're:^https?://.*\.jpg$',
571         }
572     }]
573
574     def _real_extract(self, url):
575         mobj = re.match(self._VALID_URL, url)
576         video_id = mobj.group('id')
577         player_url = 'https://player.vimeo.com/player/' + video_id
578         return self.url_result(player_url, 'Vimeo', video_id)
579
580
581 class VimeoWatchLaterIE(VimeoBaseInfoExtractor, VimeoChannelIE):
582     IE_NAME = 'vimeo:watchlater'
583     IE_DESC = 'Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)'
584     _VALID_URL = r'https?://vimeo\.com/home/watchlater|:vimeowatchlater'
585     _LOGIN_REQUIRED = True
586     _TITLE_RE = r'href="/home/watchlater".*?>(.*?)<'
587     _TESTS = [{
588         'url': 'http://vimeo.com/home/watchlater',
589         'only_matching': True,
590     }]
591
592     def _real_initialize(self):
593         self._login()
594
595     def _page_url(self, base_url, pagenum):
596         url = '%s/page:%d/' % (base_url, pagenum)
597         request = compat_urllib_request.Request(url)
598         # Set the header to get a partial html page with the ids,
599         # the normal page doesn't contain them.
600         request.add_header('X-Requested-With', 'XMLHttpRequest')
601         return request
602
603     def _real_extract(self, url):
604         return self._extract_videos('watchlater', 'https://vimeo.com/home/watchlater')
605
606
607 class VimeoLikesIE(InfoExtractor):
608     _VALID_URL = r'https?://(?:www\.)?vimeo\.com/user(?P<id>[0-9]+)/likes/?(?:$|[?#]|sort:)'
609     IE_NAME = 'vimeo:likes'
610     IE_DESC = 'Vimeo user likes'
611     _TEST = {
612         'url': 'https://vimeo.com/user755559/likes/',
613         'playlist_mincount': 293,
614         "info_dict": {
615             "description": "See all the videos urza likes",
616             "title": 'Videos urza likes',
617         },
618     }
619
620     def _real_extract(self, url):
621         user_id = self._match_id(url)
622         webpage = self._download_webpage(url, user_id)
623         page_count = self._int(
624             self._search_regex(
625                 r'''(?x)<li><a\s+href="[^"]+"\s+data-page="([0-9]+)">
626                     .*?</a></li>\s*<li\s+class="pagination_next">
627                 ''', webpage, 'page count'),
628             'page count', fatal=True)
629         PAGE_SIZE = 12
630         title = self._html_search_regex(
631             r'(?s)<h1>(.+?)</h1>', webpage, 'title', fatal=False)
632         description = self._html_search_meta('description', webpage)
633
634         def _get_page(idx):
635             page_url = '%s//vimeo.com/user%s/likes/page:%d/sort:date' % (
636                 self.http_scheme(), user_id, idx + 1)
637             webpage = self._download_webpage(
638                 page_url, user_id,
639                 note='Downloading page %d/%d' % (idx + 1, page_count))
640             video_list = self._search_regex(
641                 r'(?s)<ol class="js-browse_list[^"]+"[^>]*>(.*?)</ol>',
642                 webpage, 'video content')
643             paths = re.findall(
644                 r'<li[^>]*>\s*<a\s+href="([^"]+)"', video_list)
645             for path in paths:
646                 yield {
647                     '_type': 'url',
648                     'url': compat_urlparse.urljoin(page_url, path),
649                 }
650
651         pl = InAdvancePagedList(_get_page, page_count, PAGE_SIZE)
652
653         return {
654             '_type': 'playlist',
655             'id': 'user%s_likes' % user_id,
656             'title': title,
657             'description': description,
658             'entries': pl,
659         }