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

Code before:
            'view_count': int,
            'description': 'md5:4ec31c568a5f5a5a2b17572ea64c3825',
            'release_date': '20230812',
            'title': 'Art',
            'album': 'Art',
            'album_type': 'Album',
            'id': 'e98aafb5-d932-ee11-b8f0-00224844c719',
            'thumbnail': 'https://bl-prod-images.azureedge.net/v1.3/albums/20c890de-e94a-4422-828a-2da6377a13c8/',
        },
        'playlist_count': 13,
    }, {
        'url': 'https://www.bandlab.com/albums/89b79ea6-de42-ed11-b495-00224845aac7',
        'only_matching': True,
    }]

    def _entries(self, album_data):
        for post in traverse_obj(album_data, ('posts', lambda _, v: v['type'])):
            post_type = post['type']
            if post_type == 'Revision':
                yield self._parse_revision(post.get('revision'))
            elif post_type == 'Track':
                yield self._parse_track(post)
            elif post_type == 'Video':
                yield self._parse_video(post)
            else:
                self.report_warning(f'Skipping unknown post type: {post_type!r}')

    def _real_extract(self, url):
        playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type')

        endpoints = {
            'albums': ['albums'],
            'collections': ['collections'],
            'embed': ['collections', 'albums'],
        }.get(playlist_type)
        for endpoint in endpoints:
            playlist_data = self._call_api(
                endpoint, playlist_id, note=f'Downloading {endpoint[:-1]} data',
                fatal=False, expected_status=404)
            if not playlist_data.get('errorCode'):
                playlist_type = endpoint
                break
        if error_code := playlist_data.get('errorCode'):
            raise ExtractorError(f'Could not find playlist data. Error code: {error_code!r}')

        return self.playlist_result(
            self._entries(playlist_data), playlist_id,
            **traverse_obj(playlist_data, {
                'title': ('name', {str}),
                'description': ('description', {str}),
                'uploader': ('creator', 'name', {str}),

Review comment (suggestion):
I think double-quotes look better in user-facing output, but I realize this is über-pedantic; it's up to you
```suggestion
                self.report_warning(f'Skipping unknown post type: "{post_type}"')
```

Code after:
            'view_count': int,
            'description': 'md5:4ec31c568a5f5a5a2b17572ea64c3825',
            'release_date': '20230812',
            'title': 'Art',
            'album': 'Art',
            'album_type': 'Album',
            'id': 'e98aafb5-d932-ee11-b8f0-00224844c719',
            'thumbnail': 'https://bl-prod-images.azureedge.net/v1.3/albums/20c890de-e94a-4422-828a-2da6377a13c8/',
        },
        'playlist_count': 13,
    }, {
        'url': 'https://www.bandlab.com/albums/89b79ea6-de42-ed11-b495-00224845aac7',
        'only_matching': True,
    }]

    def _entries(self, album_data):
        for post in traverse_obj(album_data, ('posts', lambda _, v: v['type'])):
            post_type = post['type']
            if post_type == 'Revision':
                yield self._parse_revision(post.get('revision'))
            elif post_type == 'Track':
                yield self._parse_track(post)
            elif post_type == 'Video':
                yield self._parse_video(post)
            else:
                self.report_warning(f'Skipping unknown post type: "{post_type}"')

    def _real_extract(self, url):
        playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type')

        endpoints = {
            'albums': ['albums'],
            'collections': ['collections'],
            'embed': ['collections', 'albums'],
        }.get(playlist_type)
        for endpoint in endpoints:
            playlist_data = self._call_api(
                endpoint, playlist_id, note=f'Downloading {endpoint[:-1]} data',
                fatal=False, expected_status=404)
            if not playlist_data.get('errorCode'):
                playlist_type = endpoint
                break
        if error_code := playlist_data.get('errorCode'):
            raise ExtractorError(f'Could not find playlist data. Error code: "{error_code}"')

        return self.playlist_result(
            self._entries(playlist_data), playlist_id,
            **traverse_obj(playlist_data, {
                'title': ('name', {str}),
                'description': ('description', {str}),
                'uploader': ('creator', 'name', {str}),