aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-08-03 12:58:24 -0700
committerJesús <heckyel@hyperbola.info>2021-08-04 13:31:16 -0500
commit7720f3bde530f283bd4f2f56ca8382f2ceed18e0 (patch)
tree8b6f8f2c152821842449bd6c1aa46cf392032a7b /youtube
parentc62293c5cbc2305c1969572661546e1c351558ce (diff)
downloadyt-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.py3
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'],