diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-14 15:09:53 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-14 15:22:17 +0530 |
commit | 46fff7105e3d3207c2a5c6cd6588afd0a406b0a7 (patch) | |
tree | 00908f2d419dd97d70de8147986a94145b266ce9 | |
parent | 72e1fe969f7747e472ab439fac700e82c115d384 (diff) | |
download | hypervideo-pre-46fff7105e3d3207c2a5c6cd6588afd0a406b0a7.tar.lz hypervideo-pre-46fff7105e3d3207c2a5c6cd6588afd0a406b0a7.tar.xz hypervideo-pre-46fff7105e3d3207c2a5c6cd6588afd0a406b0a7.zip |
[youtube] Ignore invalid stretch ratio
Closes #244
-rw-r--r-- | yt_dlp/extractor/youtube.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 54b9ce94c..c03c63ae7 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: |