[vimeo:likes] Relax _VALID_URL and fix single page likes extraction (closes #16475)

This commit is contained in:
Sergey M․ 2018-05-17 23:21:40 +07:00
parent a3f86160fa
commit 361a965b5c
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -989,10 +989,10 @@ def _real_extract(self, url):
class VimeoLikesIE(InfoExtractor): class VimeoLikesIE(InfoExtractor):
_VALID_URL = r'https://(?:www\.)?vimeo\.com/user(?P<id>[0-9]+)/likes/?(?:$|[?#]|sort:)' _VALID_URL = r'https://(?:www\.)?vimeo\.com/(?P<id>[^/]+)/likes/?(?:$|[?#]|sort:)'
IE_NAME = 'vimeo:likes' IE_NAME = 'vimeo:likes'
IE_DESC = 'Vimeo user likes' IE_DESC = 'Vimeo user likes'
_TEST = { _TESTS = [{
'url': 'https://vimeo.com/user755559/likes/', 'url': 'https://vimeo.com/user755559/likes/',
'playlist_mincount': 293, 'playlist_mincount': 293,
'info_dict': { 'info_dict': {
@ -1000,7 +1000,10 @@ class VimeoLikesIE(InfoExtractor):
'description': 'See all the videos urza likes', 'description': 'See all the videos urza likes',
'title': 'Videos urza likes', 'title': 'Videos urza likes',
}, },
} }, {
'url': 'https://vimeo.com/stormlapse/likes',
'only_matching': True,
}]
def _real_extract(self, url): def _real_extract(self, url):
user_id = self._match_id(url) user_id = self._match_id(url)
@ -1009,7 +1012,7 @@ def _real_extract(self, url):
self._search_regex( self._search_regex(
r'''(?x)<li><a\s+href="[^"]+"\s+data-page="([0-9]+)"> r'''(?x)<li><a\s+href="[^"]+"\s+data-page="([0-9]+)">
.*?</a></li>\s*<li\s+class="pagination_next"> .*?</a></li>\s*<li\s+class="pagination_next">
''', webpage, 'page count'), ''', webpage, 'page count', default=1),
'page count', fatal=True) 'page count', fatal=True)
PAGE_SIZE = 12 PAGE_SIZE = 12
title = self._html_search_regex( title = self._html_search_regex(
@ -1017,7 +1020,7 @@ def _real_extract(self, url):
description = self._html_search_meta('description', webpage) description = self._html_search_meta('description', webpage)
def _get_page(idx): def _get_page(idx):
page_url = 'https://vimeo.com/user%s/likes/page:%d/sort:date' % ( page_url = 'https://vimeo.com/%s/likes/page:%d/sort:date' % (
user_id, idx + 1) user_id, idx + 1)
webpage = self._download_webpage( webpage = self._download_webpage(
page_url, user_id, page_url, user_id,
@ -1037,7 +1040,7 @@ def _get_page(idx):
return { return {
'_type': 'playlist', '_type': 'playlist',
'id': 'user%s_likes' % user_id, 'id': '%s_likes' % user_id,
'title': title, 'title': title,
'description': description, 'description': description,
'entries': pl, 'entries': pl,