From 0b6f0e18d90b1540bff0a75e62ca63e0704b05df Mon Sep 17 00:00:00 2001 From: merismal34 <113308532+merismal34@users.noreply.github.com> Date: Sun, 11 Sep 2022 19:28:33 +0000 Subject: [PATCH 1/3] extract audio channels from HLS streams --- yt_dlp/extractor/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index dae952f6a..86dcab07d 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2274,6 +2274,9 @@ def extract_media(x_media_line): subtitles.setdefault(lang, []).append(sub_info) if media_type not in ('VIDEO', 'AUDIO'): return + channels = media.get('CHANNELS') + if not channels is None and channels.isDigit(): + channels = int(channels) media_url = media.get('URI') if media_url: manifest_url = format_url(media_url) @@ -2284,6 +2287,7 @@ def extract_media(x_media_line): 'url': manifest_url, 'manifest_url': m3u8_url, 'language': media.get('LANGUAGE'), + 'audio_channels': channels, 'ext': ext, 'protocol': entry_protocol, 'preference': preference, From f835a62abefa9c2c85737102900eb27d9029ba9f Mon Sep 17 00:00:00 2001 From: merismal34 <113308532+merismal34@users.noreply.github.com> Date: Sun, 11 Sep 2022 19:33:51 +0000 Subject: [PATCH 2/3] Update common.py --- yt_dlp/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 86dcab07d..2b4c948fe 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2275,7 +2275,7 @@ def extract_media(x_media_line): if media_type not in ('VIDEO', 'AUDIO'): return channels = media.get('CHANNELS') - if not channels is None and channels.isDigit(): + if not channels is None and str(channels).isdigit(): channels = int(channels) media_url = media.get('URI') if media_url: From f6631360e8a629c58eed7509d560b72283010d67 Mon Sep 17 00:00:00 2001 From: merismal34 <113308532+merismal34@users.noreply.github.com> Date: Mon, 12 Sep 2022 03:19:43 +0000 Subject: [PATCH 3/3] fix linting error --- yt_dlp/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 2b4c948fe..1aa8034a5 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2275,7 +2275,7 @@ def extract_media(x_media_line): if media_type not in ('VIDEO', 'AUDIO'): return channels = media.get('CHANNELS') - if not channels is None and str(channels).isdigit(): + if channels is not None and str(channels).isdigit(): channels = int(channels) media_url = media.get('URI') if media_url: