Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vimeo] fix album extraction (issue #15704) #15855

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion youtube_dl/extractor/vimeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
urlencode_postdata,
unescapeHTML,
parse_filesize,
xpath_text,
)


Expand Down Expand Up @@ -836,6 +837,27 @@ class VimeoAlbumIE(VimeoChannelIE):
'title': 'Staff Favorites: November 2013',
},
'playlist_mincount': 13,
}, {
'url': 'https://vimeo.com/album/2632481/sort:plays/format:thumbnail',
'info_dict': {
'id': '2632481',
'title': 'Staff Favorites: November 2013',
},
'playlist_mincount': 13,
}, {
'url': 'https://vimeo.com/album/2632481/page:2/sort:plays/format:thumbnail',
'info_dict': {
'id': '2632481',
'title': 'Staff Favorites: November 2013',
},
'playlist_mincount': 13,
}, {
'url': 'https://vimeo.com/album/4786409',
'info_dict': {
'id': '4786409',
'title': 'NSSpain 2017',
},
'playlist_mincount': 25,
}, {
'note': 'Password-protected album',
'url': 'https://vimeo.com/album/3253534',
Expand All @@ -861,7 +883,42 @@ def _page_url(self, base_url, pagenum):

def _real_extract(self, url):
album_id = self._match_id(url)
return self._extract_videos(album_id, 'https://vimeo.com/album/%s' % album_id)

# we only want the base url with the id, excluding possibly appended
# options like e.g 'sort:plays'.
re_clean_url = re.compile(r'https://vimeo\.com/album/\d+')
clean_url = re_clean_url.findall(url)[0]
rss_url = clean_url + '/rss'

doc = self._download_xml(rss_url, album_id, fatal=False)

playlist_title = doc.find('./channel/title').text
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be fatal.

re_clean_title = re.compile('(?:Vimeo / )(.*)')
playlist_title = re_clean_title.findall(playlist_title)[0]

playlist_desc_el = doc.find('./channel/description')
playlist_desc = None if playlist_desc_el is None else playlist_desc_el.text

entries = []
for it in doc.findall('./channel/item'):
next_title = it.find('title').text
next_url = xpath_text(it, 'link')
if not next_url:
continue

entries.append({
'_type': 'url_transparent',
'url': next_url,
'title': next_title,
})

return {
'_type': 'playlist',
'id': album_id,
'title': playlist_title,
'description': playlist_desc,
'entries': entries,
}


class VimeoGroupsIE(VimeoAlbumIE):
Expand Down