1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-02 15:45:18 +00:00

[utils] Add join_nonempty

This commit is contained in:
pukkandan
2021-11-06 06:35:24 +05:30
parent a331949df3
commit 34921b4345
24 changed files with 82 additions and 131 deletions

View File

@@ -8,6 +8,7 @@ from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
join_nonempty,
js_to_json,
mimetype2ext,
try_get,
@@ -139,13 +140,9 @@ class DVTVIE(InfoExtractor):
label = video.get('label')
height = self._search_regex(
r'^(\d+)[pP]', label or '', 'height', default=None)
format_id = ['http']
for f in (ext, label):
if f:
format_id.append(f)
formats.append({
'url': video_url,
'format_id': '-'.join(format_id),
'format_id': join_nonempty('http', ext, label),
'height': int_or_none(height),
})
self._sort_formats(formats)