Use smaller dimension for resolution height

Previously the code assumed the height was always the second value in the "WxH" resolution string. This change splits the resolution into parts, verifies there are two components, and uses the smaller dimension (min) as the height to correctly classify vertical videos. Also avoids potential index errors when the resolution string is malformed.
This commit is contained in:
oop7
2026-04-10 15:10:00 +02:00
parent ac5690b9b0
commit 71a68d3947
+4 -1
View File
@@ -490,7 +490,10 @@ class FormatTableMixin:
resolution = format_info.get("resolution", "")
if resolution:
try:
height = int(resolution.split("x")[1])
parts = resolution.split("x")
if len(parts) == 2:
# Use the smaller dimension to correctly classify vertical videos
height = min(int(parts[0]), int(parts[1]))
except:
pass