diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-08-03 12:58:24 -0700 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-08-04 13:31:16 -0500 |
commit | 7720f3bde530f283bd4f2f56ca8382f2ceed18e0 (patch) | |
tree | 8b6f8f2c152821842449bd6c1aa46cf392032a7b /youtube | |
parent | c62293c5cbc2305c1969572661546e1c351558ce (diff) | |
download | yt-local-7720f3bde530f283bd4f2f56ca8382f2ceed18e0.tar.lz yt-local-7720f3bde530f283bd4f2f56ca8382f2ceed18e0.tar.xz yt-local-7720f3bde530f283bd4f2f56ca8382f2ceed18e0.zip |
watch: determine video source based on quality, not actual height
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 <heckyel@hyperbola.info>
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/watch.py | 3 |
1 files changed, 2 insertions, 1 deletions
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'], |