From 0fbdfe10b0606ae54cf08d889156b5ac695dbe4f Mon Sep 17 00:00:00 2001 From: Deniz Date: Sun, 24 Sep 2023 15:17:16 +0200 Subject: [PATCH] make changes for sinusbot to new release --- test/test_InfoExtractor.py | 4 ++-- yt_dlp/extractor/common.py | 1 + yt_dlp/extractor/youtube.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py index b7dee496afb9..5ea8cccd84cb 100644 --- a/test/test_InfoExtractor.py +++ b/test/test_InfoExtractor.py @@ -899,7 +899,7 @@ def test_parse_m3u8_formats(self): 'acodec': 'mp4a.40.2', 'audio_ext': 'mp4', 'video_ext': 'none', - 'abr': 41.457, + 'abr': 41, }, { 'format_id': '263', 'format_index': None, @@ -1271,7 +1271,7 @@ def test_parse_mpd_formats(self): 'protocol': 'http_dash_segments', 'audio_ext': 'm4a', 'video_ext': 'none', - 'abr': 128.001, + 'abr': 128, }, { 'format_id': 'video=100000', 'manifest_url': 'https://sdn-global-streaming-cache-3qsdn.akamaized.net/stream/3144/files/17/07/672975/3144-kZT4LWMQw6Rh7Kpd.ism/manifest.mpd', diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index c94b4abdc210..0fdc0b7a11ea 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2158,6 +2158,7 @@ def build_stream_name(): if mobj: abr, vbr = mobj.groups() abr, vbr = float_or_none(abr, 1000), float_or_none(vbr, 1000) + abr = int(abr) f.update({ 'vbr': vbr, 'abr': abr, diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index a39d17cf114b..50c22d078e1b 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -3818,7 +3818,7 @@ def build_fragments(f): video_id=video_id, only_once=True) throttled = True - tbr = float_or_none(fmt.get('averageBitrate') or fmt.get('bitrate'), 1000) + tbr = int_or_none(fmt.get('averageBitrate') or fmt.get('bitrate'), 1000) language_preference = ( 10 if audio_track.get('audioIsDefault') and 10 else -10 if 'descriptive' in (audio_track.get('displayName') or '').lower() and -10