more cleanup

Authored by: bashonly
pull/14021/head
bashonly 3 days ago
parent 4ad3288345
commit d5311a8262
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

@ -1225,13 +1225,6 @@ class VimeoIE(VimeoBaseInfoExtractor):
info[k + '_count'] = int_or_none(try_get(connections, lambda x: x[k + 's']['total'])) info[k + '_count'] = int_or_none(try_get(connections, lambda x: x[k + 's']['total']))
return info return info
def _try_album_password(self, url, is_embed, referer):
album_id = self._search_regex(
r'vimeo\.com/(?:album|showcase)/([^/]+)', url, 'album id', default=None)
if not album_id:
return
self._get_album_data_and_hashed_pass(album_id, is_embed, referer)
def _real_extract(self, url): def _real_extract(self, url):
url, data, headers = self._unsmuggle_headers(url) url, data, headers = self._unsmuggle_headers(url)
if 'Referer' not in headers: if 'Referer' not in headers:
@ -1246,9 +1239,14 @@ class VimeoIE(VimeoBaseInfoExtractor):
if any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')): if any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')):
url = 'https://vimeo.com/' + video_id url = 'https://vimeo.com/' + video_id
is_player_url = urllib.parse.urlparse(url).hostname == 'player.vimeo.com' album_id = self._search_regex(
self._try_album_password(url, is_player_url, headers['Referer']) r'vimeo\.com/(?:album|showcase)/([0-9]+)/', url, 'album id', default=None)
is_secure = urllib.parse.urlparse(url).scheme == 'https' if album_id:
# Detect password-protected showcase video => POST album password => set cookies
self._get_album_data_and_hashed_pass(album_id, '/embed' in url, headers['Referer'])
parsed_url = urllib.parse.urlparse(url)
is_secure = parsed_url.scheme == 'https'
try: try:
# Retrieve video webpage to extract further information # Retrieve video webpage to extract further information
webpage, urlh = self._download_webpage_handle( webpage, urlh = self._download_webpage_handle(
@ -1274,7 +1272,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
f'{self._downloader._format_err("compromising your security/cookies", "light red")}, ' f'{self._downloader._format_err("compromising your security/cookies", "light red")}, '
f'try replacing "https:" with "http:" in the input URL. {dcip_msg}.', expected=True) f'try replacing "https:" with "http:" in the input URL. {dcip_msg}.', expected=True)
if is_player_url: if parsed_url.hostname == 'player.vimeo.com':
config = self._search_json( config = self._search_json(
r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id) r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)
if config.get('view') == 4: if config.get('view') == 4:
@ -1302,7 +1300,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
config_url = None config_url = None
channel_id = self._search_regex( channel_id = self._search_regex(
r'vimeo\.com/channels/([^/]+)', url, 'channel id', default=None) r'vimeo\.com/channels/([^/?#]+)', url, 'channel id', default=None)
if channel_id: if channel_id:
config_url = self._extract_config_url(webpage, default=None) config_url = self._extract_config_url(webpage, default=None)
video_description = clean_html(get_element_by_class('description', webpage)) video_description = clean_html(get_element_by_class('description', webpage))

Loading…
Cancel
Save