Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/vimeo.py (Python)

Code before:
            link = video.get('link')
            if not link:
                continue
            uri = video.get('uri')
            video_id = self._search_regex(r'/videos/(\d+)', uri, 'id', default=None) if uri else None
            if is_embed:
                if not video_id:
                    self.report_warning(f'Skipping due to missing video ID: {link}')
                    continue
                link = f'https://player.vimeo.com/video/{video_id}'
                if referer:
                    link = self._smuggle_referrer(link, referer)
            yield self.url_result(link, VimeoIE.ie_key(), video_id)

    def _real_extract(self, url):
        url, _, http_headers = self._unsmuggle_headers(url)
        album_id, is_embed = self._match_valid_url(url).group('id', 'is_embed')
        referer = http_headers.get('Referer')

        if not re.fullmatch(r'[0-9]+', album_id):
            auth_info = self._download_json(
                f'https://vimeo.com/showcase/{album_id}/auth', album_id, 'Downloading album info',
                headers={'X-Requested-With': 'XMLHttpRequest', 'Referer': referer},
                expected_status=(401, 403))
            album_id = traverse_obj(auth_info, (
                'metadata', 'id', {int}, {str_or_none}, {require('album ID')}))

        album, hashed_pass = self._get_album_data_and_hashed_pass(album_id, is_embed, referer)

        entries = OnDemandPagedList(functools.partial(
            self._fetch_page, album_id, hashed_pass, is_embed, referer), self._PAGE_SIZE)
        return self.playlist_result(
            entries, album_id, album.get('name'), album.get('description'))


class VimeoGroupsIE(VimeoChannelIE):  # XXX: Do not subclass from concrete IE
    IE_NAME = 'vimeo:group'
    _VALID_URL = r'https://vimeo\.com/groups/(?P<id>[^/]+)(?:/(?!videos?/\d+)|$)'
    _TESTS = [{
        'url': 'https://vimeo.com/groups/meetup',
        'info_dict': {
            'id': 'meetup',
            'title': 'Vimeo Meetup!',
        },
        'playlist_mincount': 27,
    }]
    _BASE_URL_TEMPL = 'https://vimeo.com/groups/%s'


class VimeoReviewIE(VimeoBaseInfoExtractor):
    IE_NAME = 'vimeo:review'

Review comment (suggestion):
maybe we should always make this request so we can parse the `error_code` and raise w/ a proper msg when referer is required but missing

Code after:
                continue
            uri = video.get('uri')
            video_id = self._search_regex(r'/videos/(\d+)', uri, 'id', default=None) if uri else None
            if is_embed:
                if not video_id:
                    self.report_warning(f'Skipping due to missing video ID: {link}')
                    continue
                link = f'https://player.vimeo.com/video/{video_id}'
                if referer:
                    link = self._smuggle_referrer(link, referer)
            yield self.url_result(link, VimeoIE.ie_key(), video_id)

    def _real_extract(self, url):
        url, _, http_headers = self._unsmuggle_headers(url)
        album_id, is_embed = self._match_valid_url(url).group('id', 'is_embed')
        referer = http_headers.get('Referer')

        if not re.fullmatch(r'[0-9]+', album_id):
            auth_info = self._download_json(
                f'https://vimeo.com/showcase/{album_id}/auth', album_id, 'Downloading album info',
                headers={'X-Requested-With': 'XMLHttpRequest'}, expected_status=(401, 403))
            album_id = traverse_obj(auth_info, (
                'metadata', 'id', {int}, {str_or_none}, {require('album ID')}))

        try:
            album, hashed_pass = self._get_album_data_and_hashed_pass(album_id, is_embed, referer)
        except ExtractorError as e:
            if is_embed and not referer and isinstance(e.cause, HTTPError) and e.cause.status == 403:
                raise ExtractorError(self._REFERER_HINT, expected=True)
            raise

        entries = OnDemandPagedList(functools.partial(
            self._fetch_page, album_id, hashed_pass, is_embed, referer), self._PAGE_SIZE)
        return self.playlist_result(
            entries, album_id, album.get('name'), album.get('description'))


class VimeoGroupsIE(VimeoChannelIE):  # XXX: Do not subclass from concrete IE
    IE_NAME = 'vimeo:group'
    _VALID_URL = r'https://vimeo\.com/groups/(?P<id>[^/]+)(?:/(?!videos?/\d+)|$)'
    _TESTS = [{
        'url': 'https://vimeo.com/groups/meetup',
        'info_dict': {
            'id': 'meetup',
            'title': 'Vimeo Meetup!',
        },
        'playlist_mincount': 27,
    }]
    _BASE_URL_TEMPL = 'https://vimeo.com/groups/%s'