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 committed 2026-04-10 15:10:00 +02:00
1 parent ac5690b9b0
commit 71a68d3947
1 file changed
+4 -1
+4 -1
View File
@@ -490,7 +490,10 @@ class FormatTableMixin:
resolution = format_info.get("resolution", "") resolution = format_info.get("resolution", "")
if resolution: if resolution:
try: 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: except:
pass pass