mirror of
				https://gitlab.com/ytdl-org/youtube-dl.git
				synced 2025-11-04 03:37:08 -05:00 
			
		
		
		
	Make prefer_free_formats sorting more robust
This commit is contained in:
		@@ -674,7 +674,9 @@ class YoutubeDL(object):
 | 
				
			|||||||
                except ValueError:
 | 
					                except ValueError:
 | 
				
			||||||
                    ext_ord = -1
 | 
					                    ext_ord = -1
 | 
				
			||||||
                # We only compare the extension if they have the same height and width
 | 
					                # We only compare the extension if they have the same height and width
 | 
				
			||||||
                return (f.get('height'), f.get('width'), ext_ord)
 | 
					                return (f.get('height') if f.get('height') is not None else -1,
 | 
				
			||||||
 | 
					                        f.get('width') if f.get('width') is not None else -1,
 | 
				
			||||||
 | 
					                        ext_ord)
 | 
				
			||||||
            formats = sorted(formats, key=_free_formats_key)
 | 
					            formats = sorted(formats, key=_free_formats_key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        info_dict['formats'] = formats
 | 
					        info_dict['formats'] = formats
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user