]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/tonline.py
[utils] Add `join_nonempty`
[yt-dlp.git] / yt_dlp / extractor / tonline.py
index cc11eae2ab59b4e2720076ea50063a502a5fb419..9b6a40db51bea7010677e5d8ea212d0a1fbea851 100644 (file)
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-from ..utils import int_or_none
+from ..utils import int_or_none, join_nonempty
 
 
 class TOnlineIE(InfoExtractor):
@@ -30,13 +30,8 @@ def _real_extract(self, url):
             asset_source = asset.get('source') or asset.get('source2')
             if not asset_source:
                 continue
-            formats_id = []
-            for field_key in ('type', 'profile'):
-                field_value = asset.get(field_key)
-                if field_value:
-                    formats_id.append(field_value)
             formats.append({
-                'format_id': '-'.join(formats_id),
+                'format_id': join_nonempty('type', 'profile', from_dict=asset),
                 'url': asset_source,
             })