]> jfr.im git - yt-dlp.git/commitdiff
[youtube] Ignore invalid stretch ratio
authorpukkandan <redacted>
Wed, 14 Apr 2021 09:39:53 +0000 (15:09 +0530)
committerpukkandan <redacted>
Wed, 14 Apr 2021 09:52:17 +0000 (15:22 +0530)
Closes #244

yt_dlp/extractor/youtube.py

index 54b9ce94cb61065c4bc7a19509c820bb79765880..c03c63ae7ab2237306bcb240c94fbf3f17763381 100644 (file)
@@ -2079,8 +2079,10 @@ def feed_entry(name):
                 for m in re.finditer(self._meta_regex('og:video:tag'), webpage)]
         for keyword in keywords:
             if keyword.startswith('yt:stretch='):
-                w, h = keyword.split('=')[1].split(':')
-                w, h = int(w), int(h)
+                stretch_ratio = map(
+                    lambda x: int_or_none(x, default=0),
+                    keyword.split('=')[1].split(':'))
+                w, h = (list(stretch_ratio) + [0])[:2]
                 if w > 0 and h > 0:
                     ratio = w / h
                     for f in formats: