]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/youtube.py
[utils] Add `join_nonempty`
[yt-dlp.git] / yt_dlp / extractor / youtube.py
index 28bb2fbdf30b0becd9c5f3b89b6dde38c7be0ca2..11dba559813f822fc98f7db9a39cd7f2cf56b82b 100644 (file)
@@ -39,6 +39,7 @@
     int_or_none,
     intlist_to_bytes,
     is_html,
+    join_nonempty,
     mimetype2ext,
     network_exceptions,
     orderedSet,
@@ -2507,11 +2508,11 @@ def _extract_formats(self, streaming_data, video_id, player_url, is_live):
                 'asr': int_or_none(fmt.get('audioSampleRate')),
                 'filesize': int_or_none(fmt.get('contentLength')),
                 'format_id': itag,
-                'format_note': ', '.join(filter(None, (
+                'format_note': join_nonempty(
                     '%s%s' % (audio_track.get('displayName') or '',
                               ' (default)' if audio_track.get('audioIsDefault') else ''),
                     fmt.get('qualityLabel') or quality.replace('audio_quality_', ''),
-                    throttled and 'THROTTLED'))),
+                    throttled and 'THROTTLED', delim=', '),
                 'source_preference': -10 if throttled else -1,
                 'fps': int_or_none(fmt.get('fps')) or None,
                 'height': height,