|
|
@ -249,25 +249,46 @@ class VimeoChannelIE(InfoExtractor):
|
|
|
|
IE_NAME = u'vimeo:channel'
|
|
|
|
IE_NAME = u'vimeo:channel'
|
|
|
|
_VALID_URL = r'(?:https?://)?vimeo.\com/channels/(?P<id>[^/]+)'
|
|
|
|
_VALID_URL = r'(?:https?://)?vimeo.\com/channels/(?P<id>[^/]+)'
|
|
|
|
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
|
|
|
|
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
|
|
|
|
|
|
|
|
_TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _extract_videos(self, list_id, base_url):
|
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
|
|
|
|
channel_id = mobj.group('id')
|
|
|
|
|
|
|
|
video_ids = []
|
|
|
|
video_ids = []
|
|
|
|
|
|
|
|
|
|
|
|
for pagenum in itertools.count(1):
|
|
|
|
for pagenum in itertools.count(1):
|
|
|
|
webpage = self._download_webpage('http://vimeo.com/channels/%s/videos/page:%d' % (channel_id, pagenum),
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
channel_id, u'Downloading page %s' % pagenum)
|
|
|
|
'%s/videos/page:%d/' % (base_url, pagenum),list_id,
|
|
|
|
|
|
|
|
u'Downloading page %s' % pagenum)
|
|
|
|
video_ids.extend(re.findall(r'id="clip_(\d+?)"', webpage))
|
|
|
|
video_ids.extend(re.findall(r'id="clip_(\d+?)"', webpage))
|
|
|
|
if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
|
|
|
|
if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
entries = [self.url_result('http://vimeo.com/%s' % video_id, 'Vimeo')
|
|
|
|
entries = [self.url_result('http://vimeo.com/%s' % video_id, 'Vimeo')
|
|
|
|
for video_id in video_ids]
|
|
|
|
for video_id in video_ids]
|
|
|
|
channel_title = self._html_search_regex(r'<a href="/channels/%s">(.*?)</a>' % channel_id,
|
|
|
|
list_title = self._html_search_regex(self._TITLE_RE, webpage,
|
|
|
|
webpage, u'channel title')
|
|
|
|
u'list title')
|
|
|
|
return {'_type': 'playlist',
|
|
|
|
return {'_type': 'playlist',
|
|
|
|
'id': channel_id,
|
|
|
|
'id': list_id,
|
|
|
|
'title': channel_title,
|
|
|
|
'title': list_title,
|
|
|
|
'entries': entries,
|
|
|
|
'entries': entries,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
|
|
|
|
channel_id = mobj.group('id')
|
|
|
|
|
|
|
|
return self._extract_videos(channel_id, 'http://vimeo.com/channels/%s' % channel_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VimeoUserIE(VimeoChannelIE):
|
|
|
|
|
|
|
|
IE_NAME = u'vimeo:user'
|
|
|
|
|
|
|
|
_VALID_URL = r'(?:https?://)?vimeo.\com/(?P<name>[^/]+)'
|
|
|
|
|
|
|
|
_TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def suitable(cls, url):
|
|
|
|
|
|
|
|
if VimeoChannelIE.suitable(url) or VimeoIE.suitable(url):
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
return super(VimeoUserIE, cls).suitable(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
|
|
|
|
name = mobj.group('name')
|
|
|
|
|
|
|
|
return self._extract_videos(name, 'http://vimeo.com/%s' % name)
|
|
|
|