1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-17 14:45:42 +07:00

[extractor] Deprecate _sort_formats

This commit is contained in:
pukkandan
2022-11-17 10:40:03 +05:30
parent 784320c98c
commit 9f14daf22b
579 changed files with 69 additions and 918 deletions

View File

@@ -1699,7 +1699,14 @@ def __init__(ie, *args, **kwargs):
return FormatSort
def _sort_formats(self, formats, field_preference=[]):
if formats and field_preference:
if not field_preference:
self._downloader.deprecation_warning(
'yt_dlp.InfoExtractor._sort_formats is deprecated and is no longer required')
return
self._downloader.deprecation_warning(
'yt_dlp.InfoExtractor._sort_formats is deprecated and no longer works as expected. '
'Return _format_sort_fields in the info_dict instead')
if formats:
formats[0]['__sort_fields'] = field_preference
def _check_formats(self, formats, video_id):
@@ -2431,7 +2438,6 @@ def _parse_xspf(self, xspf_doc, playlist_id, xspf_url=None, xspf_base_url=None):
'width': int_or_none(location.get(xpath_with_ns('s1:width', NS_MAP))),
'height': int_or_none(location.get(xpath_with_ns('s1:height', NS_MAP))),
})
self._sort_formats(formats)
entries.append({
'id': playlist_id,
@@ -3269,7 +3275,6 @@ def _parse_jwplayer_data(self, jwplayer_data, video_id=None, require_title=True,
'url': formats[0]['url'],
})
else:
self._sort_formats(formats)
entry['formats'] = formats
entries.append(entry)
if len(entries) == 1: