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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user