diff options
author | fireattack <human.peng@gmail.com> | 2023-09-17 05:18:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 21:18:04 +0000 |
commit | 308936619c8a4f3a52d73c829c2006ff6c55fea2 (patch) | |
tree | ddcc745c317619f181d467553f16d88c8c540467 | |
parent | 5be7e978867b5f66ad6786c674d79d40e950ae16 (diff) |
[ie/facebook] Improve format sorting (#8074)
Authored by: fireattack
-rw-r--r-- | yt_dlp/extractor/facebook.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py index c30a6b06a..50a750d3b 100644 --- a/yt_dlp/extractor/facebook.py +++ b/yt_dlp/extractor/facebook.py @@ -505,7 +505,6 @@ class FacebookIE(InfoExtractor): # with non-browser User-Agent. for f in info['formats']: f.setdefault('http_headers', {})['User-Agent'] = 'facebookexternalhit/1.1' - info['_format_sort_fields'] = ('res', 'quality') def extract_relay_data(_filter): return self._parse_json(self._search_regex( @@ -552,7 +551,8 @@ class FacebookIE(InfoExtractor): else: formats.append({ 'format_id': format_id, - 'quality': q(format_id), + # sd, hd formats w/o resolution info should be deprioritized below DASH + 'quality': q(format_id) - 3, 'url': playable_url, }) extract_dash_manifest(video, formats) @@ -719,9 +719,11 @@ class FacebookIE(InfoExtractor): for src_type in ('src', 'src_no_ratelimit'): src = f[0].get('%s_%s' % (quality, src_type)) if src: - preference = -10 if format_id == 'progressive' else -1 + # sd, hd formats w/o resolution info should be deprioritized below DASH + # TODO: investigate if progressive or src formats still exist + preference = -10 if format_id == 'progressive' else -3 if quality == 'hd': - preference += 5 + preference += 1 formats.append({ 'format_id': '%s_%s_%s' % (format_id, quality, src_type), 'url': src, |