Skip to content

Commit

Permalink
[ie/twitter] Extract bitrate for HLS audio formats
Browse files Browse the repository at this point in the history
Authored by: bashonly
  • Loading branch information
bashonly committed Feb 21, 2024
1 parent f591e60 commit 25c16e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yt_dlp/extractor/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ def _extract_variant_formats(self, variant, video_id):
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 = {
Expand Down

0 comments on commit 25c16e1

Please sign in to comment.