mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	Remove _sort_formats from _extract_*_formats methods
Now _sort_formats should be called explicitly. _sort_formats has been added to all the necessary places in code. Closes #8051
This commit is contained in:
		| @@ -1310,6 +1310,7 @@ class GenericIE(InfoExtractor): | ||||
|                     'vcodec': 'none' if m.group('type') == 'audio' else None | ||||
|                 }] | ||||
|                 info_dict['direct'] = True | ||||
|             self._sort_formats(formats) | ||||
|             info_dict['formats'] = formats | ||||
|             return info_dict | ||||
|  | ||||
| @@ -1336,6 +1337,7 @@ class GenericIE(InfoExtractor): | ||||
|         # Is it an M3U playlist? | ||||
|         if first_bytes.startswith(b'#EXTM3U'): | ||||
|             info_dict['formats'] = self._extract_m3u8_formats(url, video_id, 'mp4') | ||||
|             self._sort_formats(info_dict['formats']) | ||||
|             return info_dict | ||||
|  | ||||
|         # Maybe it's a direct link to a video? | ||||
| @@ -1360,15 +1362,19 @@ class GenericIE(InfoExtractor): | ||||
|             if doc.tag == 'rss': | ||||
|                 return self._extract_rss(url, video_id, doc) | ||||
|             elif re.match(r'^(?:{[^}]+})?smil$', doc.tag): | ||||
|                 return self._parse_smil(doc, url, video_id) | ||||
|                 smil = self._parse_smil(doc, url, video_id) | ||||
|                 self._sort_formats(smil['formats']) | ||||
|                 return smil | ||||
|             elif doc.tag == '{http://xspf.org/ns/0/}playlist': | ||||
|                 return self.playlist_result(self._parse_xspf(doc, video_id), video_id) | ||||
|             elif re.match(r'(?i)^(?:{[^}]+})?MPD$', doc.tag): | ||||
|                 info_dict['formats'] = self._parse_mpd_formats( | ||||
|                     doc, video_id, mpd_base_url=url.rpartition('/')[0]) | ||||
|                 self._sort_formats(info_dict['formats']) | ||||
|                 return info_dict | ||||
|             elif re.match(r'^{http://ns\.adobe\.com/f4m/[12]\.0}manifest$', doc.tag): | ||||
|                 info_dict['formats'] = self._parse_f4m_formats(doc, url, video_id) | ||||
|                 self._sort_formats(info_dict['formats']) | ||||
|                 return info_dict | ||||
|         except compat_xml_parse_error: | ||||
|             pass | ||||
| @@ -2053,6 +2059,9 @@ class GenericIE(InfoExtractor): | ||||
|             else: | ||||
|                 entry_info_dict['url'] = video_url | ||||
|  | ||||
|             if entry_info_dict.get('formats'): | ||||
|                 self._sort_formats(entry_info_dict['formats']) | ||||
|  | ||||
|             entries.append(entry_info_dict) | ||||
|  | ||||
|         if len(entries) == 1: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sergey M․
					Sergey M․