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

Code before:
        )
        metadata = None
        for mb in traverse_obj(raw_metadata, ('appData', 'shows')):
            if int(mb.get('showId')) == int(show_id):
                metadata = mb

        audio_data = show_data['radioShowAudio']
        thum_id = metadata.get('imageId') or None
        if thum_id:
            thum_url = f'https://f4.bcbits.com/img/000{thum_id}_171.jpg'

        return {
            'id': show_id,
            'title': metadata.get('title'),
            'thumbnail': thum_url or None,
            'description': metadata.get('desc') or metadata.get('short_desc'),
            'duration': float_or_none(show_data.get('duration')),
            'is_live': False,
            'release_date': unified_strdate(metadata.get('date')),
            'timestamp': unified_timestamp(metadata.get('date')),
            'series': 'Bandcamp Weekly',
            'episode_id': show_id,
            'url': audio_data.get('streamUrl'),
            'ext': 'mp3',
            'vcodec': 'none',
            'format_id': f'mp3-{show_id}',
        }


class BandcampUserIE(InfoExtractor):
    IE_NAME = 'Bandcamp:user'
    _VALID_URL = r'https?://(?!www\.)(?P<id>[^.]+)\.bandcamp\.com(?:/music)?/?(?:[#?]|$)'

    _TESTS = [{
        # Type 1 Bandcamp user page.
        'url': 'https://adrianvonziegler.bandcamp.com',
        'info_dict': {
            'id': 'adrianvonziegler',
            'title': 'Discography of adrianvonziegler',
        },
        'playlist_mincount': 23,
    }, {
        # Bandcamp user page with only one album
        'url': 'http://dotscale.bandcamp.com',
        'info_dict': {
            'id': 'dotscale',
            'title': 'Discography of dotscale',
        },
        'playlist_count': 1,
    }, {
        # Type 2 Bandcamp user page.

Review comment (suggestion):
Is it certain that the `streamUrl` will link to mp3 audio?

Consider:
* conditioning the value with `stream_url = url_or_none(stream_url)`
* using the value of `determine_ext(stream_url, default_ext='mp3')` as `ext` and in the `format_id`.



Code after:
            ('appData', 'shows', lambda _, v: str(v['showId']) == show_id, any)) or {}

        series_title = audio_data.get('title') or metadata.get('title')
        release_timestamp = unified_timestamp(audio_data.get('date')) or unified_timestamp(metadata.get('date'))

        return {
            'id': show_id,
            'episode_id': show_id,
            'title': join_nonempty(series_title, strftime_or_none(release_timestamp, '%Y-%m-%d'), delim=', '),
            'series': series_title,
            'thumbnail': format_field(metadata, 'imageId', 'https://f4.bcbits.com/img/%s_0.jpg', default=None),
            'description': metadata.get('desc') or metadata.get('short_desc'),
            'duration': float_or_none(audio_data.get('duration')),
            'release_timestamp': release_timestamp,
            'formats': [{
                'url': stream_url,
                'format_id': format_id,
                'ext': encoding or 'mp3',
                'acodec': encoding or None,
                'vcodec': 'none',
                'abr': int_or_none(bitrate_str),
            }],
        }


class BandcampUserIE(InfoExtractor):
    IE_NAME = 'Bandcamp:user'
    _VALID_URL = r'https?://(?!www\.)(?P<id>[^.]+)\.bandcamp\.com(?:/music)?/?(?:[#?]|$)'

    _TESTS = [{
        # Type 1 Bandcamp user page.
        'url': 'https://adrianvonziegler.bandcamp.com',
        'info_dict': {
            'id': 'adrianvonziegler',
            'title': 'Discography of adrianvonziegler',
        },
        'playlist_mincount': 23,
    }, {
        # Bandcamp user page with only one album
        'url': 'http://dotscale.bandcamp.com',
        'info_dict': {
            'id': 'dotscale',
            'title': 'Discography of dotscale',
        },
        'playlist_count': 1,
    }, {
        # Type 2 Bandcamp user page.
        'url': 'https://nightcallofficial.bandcamp.com',
        'info_dict': {
            'id': 'nightcallofficial',
            'title': 'Discography of nightcallofficial',