A feature-rich command-line audio/video downloader
[fd/hls] Support `hls_media_playlist_data` format field (#12322)
bashonlyc987be0acb68
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex b7b19cf6e0..3293a90765 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -598,7 +598,7 @@ class YoutubeDL:# NB: Keep in sync with the docstring of extractor/common.py'url', 'manifest_url', 'manifest_stream_number', 'ext', 'format', 'format_id', 'format_note','width', 'height', 'aspect_ratio', 'resolution', 'dynamic_range', 'tbr', 'abr', 'acodec', 'asr', 'audio_channels',- 'vbr', 'fps', 'vcodec', 'container', 'filesize', 'filesize_approx', 'rows', 'columns',+ 'vbr', 'fps', 'vcodec', 'container', 'filesize', 'filesize_approx', 'rows', 'columns', 'hls_media_playlist_data','player_url', 'protocol', 'fragment_base_url', 'fragments', 'is_from_start', 'is_dash_periods', 'request_data','preference', 'language', 'language_preference', 'quality', 'source_preference', 'cookies','http_headers', 'stretched_ratio', 'no_resume', 'has_drm', 'extra_param_to_segment_url', 'extra_param_to_key_url',diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.pyindex 7bd116d968..7a47f8f836 100644--- a/yt_dlp/downloader/hls.py+++ b/yt_dlp/downloader/hls.py@@ -72,11 +72,15 @@ class HlsFD(FragmentFD):def real_download(self, filename, info_dict):man_url = info_dict['url']- self.to_screen(f'[{self.FD_NAME}] Downloading m3u8 manifest')- urlh = self.ydl.urlopen(self._prepare_url(info_dict, man_url))- man_url = urlh.url- s = urlh.read().decode('utf-8', 'ignore')+ s = info_dict.get('hls_media_playlist_data')+ if s:+ self.to_screen(f'[{self.FD_NAME}] Using m3u8 manifest from extracted info')+ else:+ self.to_screen(f'[{self.FD_NAME}] Downloading m3u8 manifest')+ urlh = self.ydl.urlopen(self._prepare_url(info_dict, man_url))+ man_url = urlh.url+ s = urlh.read().decode('utf-8', 'ignore')can_download, message = self.can_download(s, info_dict, self.params.get('allow_unplayable_formats')), Noneif can_download:diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.pyindex 92ddad2b76..3e7734ce1b 100644--- a/yt_dlp/extractor/common.py+++ b/yt_dlp/extractor/common.py@@ -201,6 +201,11 @@ class InfoExtractor:fragment_base_url* "duration" (optional, int or float)* "filesize" (optional, int)+ * hls_media_playlist_data+ The M3U8 media playlist data as a string.+ Only use if the data must be modified during extraction and+ the native HLS downloader should bypass requesting the URL.+ Does not apply if ffmpeg is used as external downloader* is_from_start Is a live format that can be downloadedfrom the start. Boolean* preference Order number of this format. If this field is