From 7720f3bde530f283bd4f2f56ca8382f2ceed18e0 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 3 Aug 2021 12:58:24 -0700 Subject: watch: determine video source based on quality, not actual height MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some phone videos, the dimensions of the video might be e.g. 360x640 instead of 640x360, which would be compared as though it was "640p", and thus no source would be chosen if default quality is 360p. Use the 'quality' entry which will always be 360 for that quality. Signed-off-by: Jesús --- youtube/watch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'youtube') diff --git a/youtube/watch.py b/youtube/watch.py index ce1637b..47a93bf 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -29,7 +29,8 @@ def get_video_sources(info): for fmt in info['formats']: if not all(fmt[attr] for attr in ('quality', 'width', 'ext', 'url')): continue - if fmt['acodec'] and fmt['vcodec'] and fmt['height'] <= max_resolution: + if (fmt['acodec'] and fmt['vcodec'] + and fmt['quality'] <= max_resolution): video_sources.append({ 'src': fmt['url'], 'type': 'video/' + fmt['ext'], -- cgit v1.2.3