]> jfr.im git - yt-dlp.git/commitdiff
[vimeo] Sort http formats higher
authorpukkandan <redacted>
Sun, 28 Nov 2021 10:54:02 +0000 (16:24 +0530)
committerpukkandan <redacted>
Mon, 29 Nov 2021 17:21:18 +0000 (22:51 +0530)
Closes #1821

yt_dlp/extractor/vimeo.py

index e2b86662beedf9b650e19b8e918f437809e783ca..27d5c969da4d531f4234337cab2a27051fe19818 100644 (file)
@@ -119,10 +119,9 @@ def _set_vimeo_cookie(self, name, value):
         self._set_cookie('vimeo.com', name, value)
 
     def _vimeo_sort_formats(self, formats):
-        # Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
-        # at the same time without actual units specified. This lead to wrong sorting.
-        # But since yt-dlp prefers 'res,fps' anyway, 'field_preference' is not needed
-        self._sort_formats(formats)
+        # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
+        # at the same time without actual units specified.
+        self._sort_formats(formats, ('quality', 'res', 'fps', 'hdr:12', 'source'))
 
     def _parse_config(self, config, video_id):
         video_data = config['video']
@@ -140,6 +139,7 @@ def _parse_config(self, config, video_id):
             formats.append({
                 'url': video_url,
                 'format_id': 'http-%s' % f.get('quality'),
+                'source_preference': 10,
                 'width': int_or_none(f.get('width')),
                 'height': int_or_none(f.get('height')),
                 'fps': int_or_none(f.get('fps')),