2 from __future__
import unicode_literals
8 from .common
import InfoExtractor
31 class VimeoBaseInfoExtractor(InfoExtractor
):
32 _NETRC_MACHINE
= 'vimeo'
33 _LOGIN_REQUIRED
= False
34 _LOGIN_URL
= 'https://vimeo.com/log_in'
37 (username
, password
) = self
._get
_login
_info
()
39 if self
._LOGIN
_REQUIRED
:
40 raise ExtractorError('No login info available, needed for using %s.' % self
.IE_NAME
, expected
=True)
43 webpage
= self
._download
_webpage
(self
._LOGIN
_URL
, None, False)
44 token
, vuid
= self
._extract
_xsrft
_and
_vuid
(webpage
)
45 data
= urlencode_postdata(encode_dict({
52 login_request
= sanitized_Request(self
._LOGIN
_URL
, data
)
53 login_request
.add_header('Content-Type', 'application/x-www-form-urlencoded')
54 login_request
.add_header('Referer', self
._LOGIN
_URL
)
55 self
._set
_vimeo
_cookie
('vuid', vuid
)
56 self
._download
_webpage
(login_request
, None, False, 'Wrong login info')
58 def _extract_xsrft_and_vuid(self
, webpage
):
59 xsrft
= self
._search
_regex
(
60 r
'(?:(?P<q1>["\'])xsrft(?P
=q1
)\s
*:|xsrft\s
*[=:])\s
*(?P
<q
>["\'])(?P<xsrft>.+?)(?P=q)',
61 webpage, 'login token', group='xsrft')
62 vuid = self._search_regex(
63 r'["\']vuid
["\']\s*:\s*(["\'])(?P
<vuid
>.+?
)\
1',
64 webpage, 'vuid
', group='vuid
')
67 def _set_vimeo_cookie(self, name, value):
68 self._set_cookie('vimeo
.com
', name, value)
71 class VimeoIE(VimeoBaseInfoExtractor):
72 """Information extractor for vimeo.com."""
74 # _VALID_URL matches Vimeo URLs
77 (?:(?:www|(?P<player>player))\.)?
78 vimeo(?P<pro>pro)?\.com/
79 (?!channels/[^/?#]+/?(?:$|[?#])|album/)
81 (?:(?:play_redirect_hls|moogaloop\.swf)\?clip_id=)?
84 /?(?:[?&].*)?(?:[#].*)?$'''
88 'url
': 'http
://vimeo
.com
/56015672#at=0',
89 'md5': '8879b6cc097e987f02484baf890129e5',
93 'title': "youtube-dl test video - \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
94 'description': 'md5:2d3305bad981a06ff79f027f19865021',
95 'upload_date': '20121220',
96 'uploader_id': 'user7108434',
97 'uploader': 'Filippo Valsorda',
102 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
103 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
104 'note': 'Vimeo Pro video (#1197)',
108 'uploader_id': 'openstreetmapus',
109 'uploader': 'OpenStreetMap US',
110 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
111 'description': 'md5:fd69a7b8d8c34a4e1d2ec2e4afd6ec30',
116 'url': 'http://player.vimeo.com/video/54469442',
117 'md5': '619b811a4417aa4abe78dc653becf511',
118 'note': 'Videos that embed the url in the player page',
122 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
123 'uploader': 'The BLN & Business of Software',
124 'uploader_id': 'theblnbusinessofsoftware',
130 'url': 'http://vimeo.com/68375962',
131 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
132 'note': 'Video protected with password',
136 'title': 'youtube-dl password protected test video',
137 'upload_date': '20130614',
138 'uploader_id': 'user18948128',
139 'uploader': 'Jaime Marquínez Ferrándiz',
141 '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\u2026',
144 'videopassword': 'youtube-dl',
148 'url': 'http://vimeo.com/channels/keypeele/75629013',
149 'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
150 'note': 'Video is freely available via original URL '
151 'and protected with password when accessed via http://vimeo.com/75629013',
155 'title': 'Key & Peele: Terrorist Interrogation',
156 'description': 'md5:8678b246399b070816b12313e8b4eb5c',
157 'uploader_id': 'atencio',
158 'uploader': 'Peter Atencio',
159 'upload_date': '20130927',
164 'url': 'http://vimeo.com/76979871',
165 'note': 'Video with subtitles',
169 'title': 'The New Vimeo Player (You Know, For Videos)',
170 'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
171 'upload_date': '20131015',
172 'uploader_id': 'staff',
173 'uploader': 'Vimeo Staff',
178 # from https://www.ouya.tv/game/Pier-Solar-and-the-Great-Architects/
179 'url': 'https://player.vimeo.com/video/98044508',
180 'note': 'The js code contains assignments to the same variable as the config',
184 'title': 'Pier Solar OUYA Official Trailer',
185 'uploader': 'Tulio Gonçalves',
186 'uploader_id': 'user28849593',
190 # contains original format
191 'url': 'https://vimeo.com/33951933',
192 'md5': '53c688fa95a55bf4b7293d37a89c5c53',
196 'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute',
197 'uploader': 'The DMCI',
198 'uploader_id': 'dmci',
199 'upload_date': '20111220',
200 'description': 'md5:ae23671e82d05415868f7ad1aec21147',
204 'url': 'https://vimeo.com/109815029',
205 'note': 'Video not completely processed, "failed" seed status',
206 'only_matching': True,
209 'url': 'https://vimeo.com/groups/travelhd/videos/22439234',
210 'only_matching': True,
213 # source file returns 403: Forbidden
214 'url': 'https://vimeo.com/7809605',
215 'only_matching': True,
220 def _extract_vimeo_url(url
, webpage
):
221 # Look for embedded (iframe) Vimeo player
223 r
'<iframe[^>]+?src=(["\'])(?P
<url
>(?
:https?
:)?
//player\
.vimeo\
.com
/video
/.+?
)\
1', webpage)
225 player_url = unescapeHTML(mobj.group('url
'))
226 surl = smuggle_url(player_url, {'http_headers
': {'Referer
': url}})
228 # Look for embedded (swf embed) Vimeo player
230 r'<embed
[^
>]+?src
="((?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)"', webpage)
234 def _verify_video_password(self, url, video_id, webpage):
235 password = self._downloader.params.get('videopassword
')
237 raise ExtractorError('This video
is protected by a password
, use the
--video
-password option
', expected=True)
238 token, vuid = self._extract_xsrft_and_vuid(webpage)
239 data = urlencode_postdata(encode_dict({
240 'password
': password,
243 if url.startswith('http
://'):
244 # vimeo only supports https now, but the user can give an http url
245 url = url.replace('http
://', 'https
://')
246 password_request = sanitized_Request(url + '/password
', data)
247 password_request.add_header('Content
-Type
', 'application
/x
-www
-form
-urlencoded
')
248 password_request.add_header('Referer
', url)
249 self._set_vimeo_cookie('vuid
', vuid)
250 return self._download_webpage(
251 password_request, video_id,
252 'Verifying the password
', 'Wrong password
')
254 def _verify_player_video_password(self, url, video_id):
255 password = self._downloader.params.get('videopassword
')
257 raise ExtractorError('This video
is protected by a password
, use the
--video
-password option
')
258 data = urlencode_postdata(encode_dict({'password
': password}))
259 pass_url = url + '/check
-password
'
260 password_request = sanitized_Request(pass_url, data)
261 password_request.add_header('Content
-Type
', 'application
/x
-www
-form
-urlencoded
')
262 return self._download_json(
263 password_request, video_id,
264 'Verifying the password
',
267 def _real_initialize(self):
270 def _real_extract(self, url):
271 url, data = unsmuggle_url(url, {})
272 headers = std_headers
273 if 'http_headers
' in data:
274 headers = headers.copy()
275 headers.update(data['http_headers
'])
276 if 'Referer
' not in headers:
277 headers['Referer
'] = url
279 # Extract ID from URL
280 mobj = re.match(self._VALID_URL, url)
281 video_id = mobj.group('id')
283 if mobj.group('pro
') or mobj.group('player
'):
284 url = 'https
://player
.vimeo
.com
/video
/' + video_id
286 url = 'https
://vimeo
.com
/' + video_id
288 # Retrieve video webpage to extract further information
289 request = sanitized_Request(url, None, headers)
291 webpage = self._download_webpage(request, video_id)
292 except ExtractorError as ee:
293 if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
294 errmsg = ee.cause.read()
295 if b'Because of its privacy settings
, this video cannot be played here
' in errmsg:
296 raise ExtractorError(
297 'Cannot download embed
-only video without embedding
'
298 'URL
. Please call youtube
-dl
with the URL of the page
'
299 'that embeds this video
.',
303 # Now we begin extracting as much information as we can from what we
304 # retrieved. First we extract the information common to all extractors,
305 # and latter we extract those that are Vimeo specific.
306 self.report_extraction(video_id)
308 vimeo_config = self._search_regex(
309 r'vimeo\
.config\s
*=\s
*(?
:({.+?
})|_extend\
([^
,]+,\s
+({.+?
})\
));', webpage,
310 'vimeo config
', default=None)
312 seed_status = self._parse_json(vimeo_config, video_id).get('seed_status
', {})
313 if seed_status.get('state
') == 'failed
':
314 raise ExtractorError(
315 '%s said
: %s' % (self.IE_NAME, seed_status['title
']),
318 # Extract the config JSON
321 config_url = self._html_search_regex(
322 r' data
-config
-url
="(.+?)"', webpage,
323 'config URL
', default=None)
325 # Sometimes new react-based page is served instead of old one that require
326 # different config URL extraction approach (see
327 # https://github.com/rg3/youtube-dl/pull/7209)
328 vimeo_clip_page_config = self._search_regex(
329 r'vimeo\
.clip_page_config\s
*=\s
*({.+?
});', webpage,
330 'vimeo clip page config
')
331 config_url = self._parse_json(
332 vimeo_clip_page_config, video_id)['player
']['config_url
']
333 config_json = self._download_webpage(config_url, video_id)
334 config = json.loads(config_json)
335 except RegexNotFoundError:
336 # For pro videos or player.vimeo.com urls
337 # We try to find out to which variable is assigned the config dic
338 m_variable_name = re.search('(\w
)\
.video\
.id', webpage)
339 if m_variable_name is not None:
340 config_re = r'%s=({[^
}].+?
});' % re.escape(m_variable_name.group(1))
342 config_re = [r' = {config
:({.+?
}),assets
:', r'(?
:[abc
])=({.+?
});']
343 config = self._search_regex(config_re, webpage, 'info section
',
345 config = json.loads(config)
346 except Exception as e:
347 if re.search('The creator of this video has
not given you permission to embed it on this domain
.', webpage):
348 raise ExtractorError('The author has restricted the access to this video
, try with the
"--referer" option
')
350 if re.search(r'<form
[^
>]+?
id="pw_form"', webpage) is not None:
351 if '_video_password_verified
' in data:
352 raise ExtractorError('video password verification failed
!')
353 self._verify_video_password(url, video_id, webpage)
354 return self._real_extract(
355 smuggle_url(url, {'_video_password_verified
': 'verified
'}))
357 raise ExtractorError('Unable to extract info section
',
360 if config.get('view
') == 4:
361 config = self._verify_player_video_password(url, video_id)
363 if '>You rented this title
.<' in webpage:
364 feature_id = config.get('video
', {}).get('vod
', {}).get('feature_id
')
365 if feature_id and not data.get('force_feature_id
', False):
366 return self.url_result(smuggle_url(
367 'https
://player
.vimeo
.com
/player
/%s' % feature_id,
368 {'force_feature_id
': True}), 'Vimeo
')
371 video_title = config['video
']['title
']
373 # Extract uploader and uploader_id
374 video_uploader = config['video
']['owner
']['name
']
375 video_uploader_id = config['video
']['owner
']['url
'].split('/')[-1] if config['video
']['owner
']['url
'] else None
377 # Extract video thumbnail
378 video_thumbnail = config['video
'].get('thumbnail
')
379 if video_thumbnail is None:
380 video_thumbs = config['video
'].get('thumbs
')
381 if video_thumbs and isinstance(video_thumbs, dict):
382 _, video_thumbnail = sorted((int(width if width.isdigit() else 0), t_url) for (width, t_url) in video_thumbs.items())[-1]
384 # Extract video description
386 video_description = self._html_search_regex(
387 r'(?s
)<div\s
+class="[^"]*description
[^
"]*"[^
>]*>(.*?
)</div
>',
388 webpage, 'description
', default=None)
389 if not video_description:
390 video_description = self._html_search_meta(
391 'description
', webpage, default=None)
392 if not video_description and mobj.group('pro
'):
393 orig_webpage = self._download_webpage(
395 note='Downloading webpage
for description
',
398 video_description = self._html_search_meta(
399 'description
', orig_webpage, default=None)
400 if not video_description and not mobj.group('player
'):
401 self._downloader.report_warning('Cannot find video description
')
403 # Extract video duration
404 video_duration = int_or_none(config['video
'].get('duration
'))
406 # Extract upload date
407 video_upload_date = None
408 mobj = re.search(r'<time
[^
>]+datetime
="([^"]+)"', webpage)
410 video_upload_date = unified_strdate(mobj.group(1))
413 view_count = int(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count'))
414 like_count = int(self._search_regex(r'UserLikes:(\d+)', webpage, 'like count'))
415 comment_count = int(self._search_regex(r'UserComments:(\d+)', webpage, 'comment count'))
416 except RegexNotFoundError:
417 # This info is only available in vimeo.com/{id} urls
423 download_request = sanitized_Request('https://vimeo.com/%s?action=load_download_config' % video_id, headers={
424 'X-Requested-With': 'XMLHttpRequest'})
425 download_data = self._download_json(download_request, video_id, fatal=False)
427 source_file = download_data.get('source_file')
428 if isinstance(source_file, dict):
429 download_url = source_file.get('download_url')
430 if download_url and not source_file.get('is_cold') and not source_file.get('is_defrosting'):
431 source_name = source_file.get('public_name', 'Original')
432 if self._is_valid_url(download_url, video_id, '%s video' % source_name):
433 ext = source_file.get('extension', determine_ext(download_url)).lower()
437 'width': int_or_none(source_file.get('width')),
438 'height': int_or_none(source_file.get('height')),
439 'filesize': parse_filesize(source_file.get('size')),
440 'format_id': source_name,
443 config_files = config['video'].get('files') or config['request'].get('files', {})
444 for f in config_files.get('progressive', []):
445 video_url = f.get('url')
450 'format_id': 'http-%s' % f.get('quality'),
451 'width': int_or_none(f.get('width')),
452 'height': int_or_none(f.get('height')),
453 'fps': int_or_none(f.get('fps')),
454 'tbr': int_or_none(f.get('bitrate')),
456 m3u8_url = config_files.get('hls', {}).get('url')
458 formats.extend(self._extract_m3u8_formats(
459 m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
460 # Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
461 # at the same time without actual units specified. This lead to wrong sorting.
462 self._sort_formats(formats, field_preference=('preference', 'height', 'width', 'fps', 'format_id'))
465 text_tracks = config['request'].get('text_tracks')
467 for tt in text_tracks:
468 subtitles[tt['lang']] = [{
470 'url': 'https://vimeo.com' + tt['url'],
475 'uploader': video_uploader,
476 'uploader_id': video_uploader_id,
477 'upload_date': video_upload_date,
478 'title': video_title,
479 'thumbnail': video_thumbnail,
480 'description': video_description,
481 'duration': video_duration,
484 'view_count': view_count,
485 'like_count': like_count,
486 'comment_count': comment_count,
487 'subtitles': subtitles,
491 class VimeoChannelIE(VimeoBaseInfoExtractor):
492 IE_NAME = 'vimeo:channel'
493 _VALID_URL = r'https://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
494 _MORE_PAGES_INDICATOR = r'<a.+?rel="next
"'
496 _TITLE_RE = r'<link rel="alternate
"[^>]+?title="(.*?
)"'
498 'url': 'https://vimeo.com/channels/tributes',
501 'title': 'Vimeo Tributes',
503 'playlist_mincount': 25,
506 def _page_url(self, base_url, pagenum):
507 return '%s/videos/page:%d/' % (base_url, pagenum)
509 def _extract_list_title(self, webpage):
510 return self._TITLE or self._html_search_regex(self._TITLE_RE, webpage, 'list title')
512 def _login_list_password(self, page_url, list_id, webpage):
513 login_form = self._search_regex(
514 r'(?s)<form[^>]+?id="pw_form
"(.*?)</form>',
515 webpage, 'login form', default=None)
519 password = self._downloader.params.get('videopassword')
521 raise ExtractorError('This album is protected by a password, use the --video-password option', expected=True)
522 fields = self._hidden_inputs(login_form)
523 token, vuid = self._extract_xsrft_and_vuid(webpage)
524 fields['token'] = token
525 fields['password'] = password
526 post = urlencode_postdata(encode_dict(fields))
527 password_path = self._search_regex(
528 r'action="([^
"]+)"', login_form, 'password URL
')
529 password_url = compat_urlparse.urljoin(page_url, password_path)
530 password_request = sanitized_Request(password_url, post)
531 password_request.add_header('Content
-type', 'application
/x
-www
-form
-urlencoded
')
532 self._set_vimeo_cookie('vuid
', vuid)
533 self._set_vimeo_cookie('xsrft
', token)
535 return self._download_webpage(
536 password_request, list_id,
537 'Verifying the password
', 'Wrong password
')
539 def _title_and_entries(self, list_id, base_url):
540 for pagenum in itertools.count(1):
541 page_url = self._page_url(base_url, pagenum)
542 webpage = self._download_webpage(
544 'Downloading page
%s' % pagenum)
547 webpage = self._login_list_password(page_url, list_id, webpage)
548 yield self._extract_list_title(webpage)
550 for video_id in re.findall(r'id="clip_(\d+?)"', webpage):
551 yield self.url_result('https
://vimeo
.com
/%s' % video_id, 'Vimeo
')
553 if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
556 def _extract_videos(self, list_id, base_url):
557 title_and_entries = self._title_and_entries(list_id, base_url)
558 list_title = next(title_and_entries)
559 return self.playlist_result(title_and_entries, list_id, list_title)
561 def _real_extract(self, url):
562 mobj = re.match(self._VALID_URL, url)
563 channel_id = mobj.group('id')
564 return self._extract_videos(channel_id, 'https
://vimeo
.com
/channels
/%s' % channel_id)
567 class VimeoUserIE(VimeoChannelIE):
568 IE_NAME = 'vimeo
:user
'
569 _VALID_URL = r'https
://vimeo\
.com
/(?
!(?
:[0-9]+|watchlater
)(?
:$|
[?
#/]))(?P<name>[^/]+)(?:/videos|[#?]|$)'
570 _TITLE_RE
= r
'<a[^>]+?class="user">([^<>]+?)</a>'
572 'url': 'https://vimeo.com/nkistudio/videos',
577 'playlist_mincount': 66,
580 def _real_extract(self
, url
):
581 mobj
= re
.match(self
._VALID
_URL
, url
)
582 name
= mobj
.group('name')
583 return self
._extract
_videos
(name
, 'https://vimeo.com/%s' % name
)
586 class VimeoAlbumIE(VimeoChannelIE
):
587 IE_NAME
= 'vimeo:album'
588 _VALID_URL
= r
'https://vimeo\.com/album/(?P<id>\d+)'
589 _TITLE_RE
= r
'<header id="page_header">\n\s*<h1>(.*?)</h1>'
591 'url': 'https://vimeo.com/album/2632481',
594 'title': 'Staff Favorites: November 2013',
596 'playlist_mincount': 13,
598 'note': 'Password-protected album',
599 'url': 'https://vimeo.com/album/3253534',
606 'videopassword': 'youtube-dl',
610 def _page_url(self
, base_url
, pagenum
):
611 return '%s/page:%d/' % (base_url
, pagenum
)
613 def _real_extract(self
, url
):
614 album_id
= self
._match
_id
(url
)
615 return self
._extract
_videos
(album_id
, 'https://vimeo.com/album/%s' % album_id
)
618 class VimeoGroupsIE(VimeoAlbumIE
):
619 IE_NAME
= 'vimeo:group'
620 _VALID_URL
= r
'https://vimeo\.com/groups/(?P<name>[^/]+)(?:/(?!videos?/\d+)|$)'
622 'url': 'https://vimeo.com/groups/rolexawards',
625 'title': 'Rolex Awards for Enterprise',
627 'playlist_mincount': 73,
630 def _extract_list_title(self
, webpage
):
631 return self
._og
_search
_title
(webpage
)
633 def _real_extract(self
, url
):
634 mobj
= re
.match(self
._VALID
_URL
, url
)
635 name
= mobj
.group('name')
636 return self
._extract
_videos
(name
, 'https://vimeo.com/groups/%s' % name
)
639 class VimeoReviewIE(InfoExtractor
):
640 IE_NAME
= 'vimeo:review'
641 IE_DESC
= 'Review pages on vimeo'
642 _VALID_URL
= r
'https://vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
644 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
645 'md5': 'c507a72f780cacc12b2248bb4006d253',
649 'title': "DICK HARDWICK 'Comedian'",
650 'uploader': 'Richard Hardwick',
653 'note': 'video player needs Referer',
654 'url': 'https://vimeo.com/user22258446/review/91613211/13f927e053',
655 'md5': '6295fdab8f4bf6a002d058b2c6dce276',
659 'title': 're:(?i)^Death by dogma versus assembling agile . Sander Hoogendoorn',
660 'uploader': 'DevWeek Events',
662 'thumbnail': 're:^https?://.*\.jpg$',
666 def _real_extract(self
, url
):
667 mobj
= re
.match(self
._VALID
_URL
, url
)
668 video_id
= mobj
.group('id')
669 player_url
= 'https://player.vimeo.com/player/' + video_id
670 return self
.url_result(player_url
, 'Vimeo', video_id
)
673 class VimeoWatchLaterIE(VimeoChannelIE
):
674 IE_NAME
= 'vimeo:watchlater'
675 IE_DESC
= 'Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)'
676 _VALID_URL
= r
'https://vimeo\.com/(?:home/)?watchlater|:vimeowatchlater'
677 _TITLE
= 'Watch Later'
678 _LOGIN_REQUIRED
= True
680 'url': 'https://vimeo.com/watchlater',
681 'only_matching': True,
684 def _real_initialize(self
):
687 def _page_url(self
, base_url
, pagenum
):
688 url
= '%s/page:%d/' % (base_url
, pagenum
)
689 request
= sanitized_Request(url
)
690 # Set the header to get a partial html page with the ids,
691 # the normal page doesn't contain them.
692 request
.add_header('X-Requested-With', 'XMLHttpRequest')
695 def _real_extract(self
, url
):
696 return self
._extract
_videos
('watchlater', 'https://vimeo.com/watchlater')
699 class VimeoLikesIE(InfoExtractor
):
700 _VALID_URL
= r
'https://(?:www\.)?vimeo\.com/user(?P<id>[0-9]+)/likes/?(?:$|[?#]|sort:)'
701 IE_NAME
= 'vimeo:likes'
702 IE_DESC
= 'Vimeo user likes'
704 'url': 'https://vimeo.com/user755559/likes/',
705 'playlist_mincount': 293,
707 'id': 'user755559_likes',
708 'description': 'See all the videos urza likes',
709 'title': 'Videos urza likes',
713 def _real_extract(self
, url
):
714 user_id
= self
._match
_id
(url
)
715 webpage
= self
._download
_webpage
(url
, user_id
)
716 page_count
= self
._int
(
718 r
'''(?x)<li><a\s+href="[^"]+"\s+data-page="([0-9]+)">
719 .*?</a></li>\s*<li\s+class="pagination_next">
720 ''', webpage
, 'page count'),
721 'page count', fatal
=True)
723 title
= self
._html
_search
_regex
(
724 r
'(?s)<h1>(.+?)</h1>', webpage
, 'title', fatal
=False)
725 description
= self
._html
_search
_meta
('description', webpage
)
728 page_url
= 'https://vimeo.com/user%s/likes/page:%d/sort:date' % (
730 webpage
= self
._download
_webpage
(
732 note
='Downloading page %d/%d' % (idx
+ 1, page_count
))
733 video_list
= self
._search
_regex
(
734 r
'(?s)<ol class="js-browse_list[^"]+"[^>]*>(.*?)</ol>',
735 webpage
, 'video content')
737 r
'<li[^>]*>\s*<a\s+href="([^"]+)"', video_list
)
741 'url': compat_urlparse
.urljoin(page_url
, path
),
744 pl
= InAdvancePagedList(_get_page
, page_count
, PAGE_SIZE
)
748 'id': 'user%s_likes' % user_id
,
750 'description': description
,