mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	[youtube] Fix sorting of 3gp format
This commit is contained in:
		@@ -2404,6 +2404,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
 | 
				
			|||||||
        formats, itags, stream_ids = [], [], []
 | 
					        formats, itags, stream_ids = [], [], []
 | 
				
			||||||
        itag_qualities = {}
 | 
					        itag_qualities = {}
 | 
				
			||||||
        q = qualities([
 | 
					        q = qualities([
 | 
				
			||||||
 | 
					            # "tiny" is the smallest video-only format. But some audio-only formats
 | 
				
			||||||
 | 
					            # was also labeled "tiny". It is not clear if such formats still exist
 | 
				
			||||||
            'tiny', 'audio_quality_low', 'audio_quality_medium', 'audio_quality_high',  # Audio only formats
 | 
					            'tiny', 'audio_quality_low', 'audio_quality_medium', 'audio_quality_high',  # Audio only formats
 | 
				
			||||||
            'small', 'medium', 'large', 'hd720', 'hd1080', 'hd1440', 'hd2160', 'hd2880', 'highres'
 | 
					            'small', 'medium', 'large', 'hd720', 'hd1080', 'hd1440', 'hd2160', 'hd2880', 'highres'
 | 
				
			||||||
        ])
 | 
					        ])
 | 
				
			||||||
@@ -2467,13 +2469,15 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
 | 
				
			|||||||
                'width': fmt.get('width'),
 | 
					                'width': fmt.get('width'),
 | 
				
			||||||
                'language': audio_track.get('id', '').split('.')[0],
 | 
					                'language': audio_track.get('id', '').split('.')[0],
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            mimetype = fmt.get('mimeType')
 | 
					            mime_mobj = re.match(
 | 
				
			||||||
            if mimetype:
 | 
					                r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', fmt.get('mimeType') or '')
 | 
				
			||||||
                mobj = re.match(
 | 
					            if mime_mobj:
 | 
				
			||||||
                    r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', mimetype)
 | 
					                dct['ext'] = mimetype2ext(mime_mobj.group(1))
 | 
				
			||||||
                if mobj:
 | 
					                dct.update(parse_codecs(mime_mobj.group(2)))
 | 
				
			||||||
                    dct['ext'] = mimetype2ext(mobj.group(1))
 | 
					                # The 3gp format in android client has a quality of "small",
 | 
				
			||||||
                    dct.update(parse_codecs(mobj.group(2)))
 | 
					                # but is actually worse than all other formats
 | 
				
			||||||
 | 
					                if dct['ext'] == '3gp':
 | 
				
			||||||
 | 
					                    dct['quality'] = q('tiny')
 | 
				
			||||||
            no_audio = dct.get('acodec') == 'none'
 | 
					            no_audio = dct.get('acodec') == 'none'
 | 
				
			||||||
            no_video = dct.get('vcodec') == 'none'
 | 
					            no_video = dct.get('vcodec') == 'none'
 | 
				
			||||||
            if no_audio:
 | 
					            if no_audio:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user