From 46fff7105e3d3207c2a5c6cd6588afd0a406b0a7 Mon Sep 17 00:00:00 2001
From: pukkandan <pukkandan.ytdlp@gmail.com>
Date: Wed, 14 Apr 2021 15:09:53 +0530
Subject: [PATCH] [youtube] Ignore invalid stretch ratio Closes #244

---
 yt_dlp/extractor/youtube.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 54b9ce94cb..c03c63ae7a 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -2079,8 +2079,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
                 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: