diff options
author | bashonly <88596187+bashonly@users.noreply.github.com> | 2024-02-21 02:39:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-21 08:39:10 +0000 |
commit | 28e53d60df9b8aadd52a93504e30e885c9c35262 (patch) | |
tree | b21273dc8f68be71c489cf01ae255d2180a066fc | |
parent | f591e605dfee4085ec007d6d056c943cbcacc429 (diff) |
[ie/twitter] Extract bitrate for HLS audio formats (#9257)
Closes #9202
Authored by: bashonly
-rw-r--r-- | yt_dlp/extractor/twitter.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py index c3a6e406c..63a3c1c84 100644 --- a/yt_dlp/extractor/twitter.py +++ b/yt_dlp/extractor/twitter.py @@ -100,9 +100,13 @@ class TwitterBaseIE(InfoExtractor): if not variant_url: return [], {} elif '.m3u8' in variant_url: - return self._extract_m3u8_formats_and_subtitles( + fmts, subs = self._extract_m3u8_formats_and_subtitles( variant_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False) + for f in traverse_obj(fmts, lambda _, v: v['vcodec'] == 'none' and v.get('tbr') is None): + if mobj := re.match(r'hls-[Aa]udio-(?P<bitrate>\d{4,})', f['format_id']): + f['tbr'] = int_or_none(mobj.group('bitrate'), 1000) + return fmts, subs else: tbr = int_or_none(dict_get(variant, ('bitrate', 'bit_rate')), 1000) or None f = { |