aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/extractor/threeqsdn.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-11-06 06:35:24 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-11-06 07:53:55 +0530
commit34921b43451a23d8cd7350f8511269bdfd35cf61 (patch)
tree4cc0f567f0b159299b41de0b2b372e066936be3f /yt_dlp/extractor/threeqsdn.py
parenta331949df396d69e648fad61a80ada5da3279704 (diff)
[utils] Add `join_nonempty`
Diffstat (limited to 'yt_dlp/extractor/threeqsdn.py')
-rw-r--r--yt_dlp/extractor/threeqsdn.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/yt_dlp/extractor/threeqsdn.py b/yt_dlp/extractor/threeqsdn.py
index bb7610352..e5c6a6de1 100644
--- a/yt_dlp/extractor/threeqsdn.py
+++ b/yt_dlp/extractor/threeqsdn.py
@@ -9,6 +9,7 @@ from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
+ join_nonempty,
parse_iso8601,
)
@@ -119,24 +120,16 @@ class ThreeQSDNIE(InfoExtractor):
src = s.get('src')
if not (src and self._is_valid_url(src, video_id)):
continue
- width = None
- format_id = ['http']
ext = determine_ext(src)
- if ext:
- format_id.append(ext)
height = int_or_none(s.get('height'))
- if height:
- format_id.append('%dp' % height)
- if aspect:
- width = int(height * aspect)
formats.append({
'ext': ext,
- 'format_id': '-'.join(format_id),
+ 'format_id': join_nonempty('http', ext, height and '%dp' % height),
'height': height,
'source_preference': 0,
'url': src,
'vcodec': 'none' if height == 0 else None,
- 'width': width,
+ 'width': int(height * aspect) if height and aspect else None,
})
# It seems like this would be correctly handled by default
# However, unless someone can confirm this, the old