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

Code before:
        tracks = []

        for track in music_list:
            track_details = []

            if name := track.get('name'):
                track_details.append(f'「{name}」')
            if lyricist := track.get('lyricist'):
                track_details.append(f'{lyricist}:作詞')
            if composer := track.get('composer'):
                track_details.append(f'{composer}:作曲')
            if arranger := track.get('arranger'):
                track_details.append(f'{arranger}:編曲')
            track_details.append(self._fetch_artists(track.get('byArtist')))
            track_details.append(self._fetch_duration(track.get('duration')))

            if track.get('label') or track.get('code'):
                track_details.append('＜' + join_nonempty('label', 'code', delim=' ', from_dict=track) + '＞')

            if location := track.get('location'):
                track_details.append(f'～{location}～')

            tracks.append(join_nonempty(*track_details, delim='\n'))

        return '\n\n'.join(tracks)

    def _format_description(self, response):
        act = traverse_obj(response, ('misc', 'actList', {self._format_actlist}))
        music = traverse_obj(response, ('misc', 'musicList', {self._format_musiclist}))
        desc = join_nonempty('epg80', 'epg200', delim='\n\n', from_dict=traverse_obj(response, 'detailedDescription'))

        return join_nonempty(desc, act, music, delim='\n\n')

    def _get_thumbnails(self, thumbs, name, preference=-1):
        thumbnails = []
        if thumbs is None or len(thumbs) == 0:
            return []
        for size, thumb in thumbs:
            if size == 'copyright' or not isinstance(thumb, dict):
                continue
            thumbnails.append({**thumb,
                               'preference': preference,
                               'id': join_nonempty(name, size),
                               })
            preference -= 1
        return thumbnails

    def _extract_extended_metadata(self, episode_id, aa_vinfo):
        service, _, area = traverse_obj(aa_vinfo, (2, {str}, {lambda x: (x or '').partition(',')}))
        dateid = aa_vinfo[3]


Review comment (suggestion):
same concept as above with `_get_artists`
```suggestion
    def _format_music_list(self, music_list):
        tracks = []
        for track in traverse_obj(music_list, (..., {dict})):
            track_details = traverse_obj(track, (
                ..., ('name', filter, {'「{}」'.format}),
                ('lyricist', filter, {'{}:作詞'.format}),
                ('composer', filter, {'{}:作曲'.format}),
                ('arranger', filter, {'{}:編曲'.format}),
            ))
            track_details.append(self._fetch_artists(track, 'byArtist'))
            track_details.append(self._fetch_duration(track, 'duration'))
            if label := join_nonempty('label', 'code', delim=' ', from_dict=track):
                track_details.append(f'＜{label}＞')
            if location := traverse_obj(track, ('location', {str})):
                track_details.append(f'～{location}～')

            tracks.append(join_nonempty(*track_details, delim='\n'))

        return '\n\n'.join(tracks)

```

Code after:
                track_details.append(f'＜{label}＞')
            if location := traverse_obj(track, ('location', {str})):
                track_details.append(f'～{location}～')
            tracks.append(join_nonempty(*track_details, delim='\n'))
        return '\n\n'.join(tracks)

    def _format_description(self, response):
        detailed_description = traverse_obj(response, ('detailedDescription', {dict})) or {}
        return join_nonempty(
            join_nonempty('epg80', 'epg200', delim='\n\n', from_dict=detailed_description),
            traverse_obj(response, ('misc', 'actList', {self._format_act_list})),
            traverse_obj(response, ('misc', 'musicList', {self._format_music_list})),
            delim='\n\n')

    def _get_thumbnails(self, data, keys, name=None, preference=-1):
        thumbnails = []
        for size, thumb in traverse_obj(data, (
            *variadic(keys, (str, bytes, dict, set)), {dict.items},
            lambda _, v: v[0] != 'copyright' and url_or_none(v[1]['url']),
        )):
            thumbnails.append({
                'url': thumb['url'],
                'width': int_or_none(thumb.get('width')),
                'height': int_or_none(thumb.get('height')),
                'preference': preference,
                'id': join_nonempty(name, size),
            })
            preference -= 1
        return thumbnails

    def _extract_extended_metadata(self, episode_id, aa_vinfo):
        service, _, area = traverse_obj(aa_vinfo, (2, {str}, {lambda x: (x or '').partition(',')}))
        date_id = aa_vinfo[3]

        detail_url = try_call(
            lambda: self._API_URL_TMPL.format(broadcastEventId=join_nonempty(service, area, date_id)))
        if not detail_url:
            return {}

        response = self._download_json(
            detail_url, episode_id, 'Downloading extended metadata',
            'Failed to download extended metadata', fatal=False, expected_status=400)
        if not response:
            return {}

        if error := traverse_obj(response, ('error', {dict})):
            self.report_warning(
                'Failed to get extended metadata. API returned '
                f'Error {join_nonempty("statuscode", "message", from_dict=error, delim=": ")}')
            return {}