From 78895bd3a101642fbdadffab27abae0d655b16c9 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 16 Sep 2020 13:00:41 +0200 Subject: [PATCH] [Core] hls manifests, dynamic mpd --- README.md | 19 ++++++++++++++++++- youtube_dlc/__init__.py | 2 ++ youtube_dlc/extractor/common.py | 5 +++-- youtube_dlc/extractor/youtube.py | 3 ++- youtube_dlc/options.py | 19 +++++++++++++++++++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2a51eb66c..b15653c23 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,20 @@ youtube-dlc is a fork of youtube-dl with the intention of getting features teste - [INSTALLATION](#installation) - [DESCRIPTION](#description) - [OPTIONS](#options) -- [COPYRIGHT](#copyright) + - [Network Options:](#network-options) + - [Geo Restriction:](#geo-restriction) + - [Video Selection:](#video-selection) + - [Download Options:](#download-options) + - [Filesystem Options:](#filesystem-options) + - [Thumbnail images:](#thumbnail-images) + - [Verbosity / Simulation Options:](#verbosity--simulation-options) + - [Workarounds:](#workarounds) + - [Video Format Options:](#video-format-options) + - [Subtitle Options:](#subtitle-options) + - [Authentication Options:](#authentication-options) + - [Adobe Pass Options:](#adobe-pass-options) + - [Post-processing Options:](#post-processing-options) + - [Extractor Options:](#extractor-options) # INSTALLATION @@ -355,6 +368,8 @@ Then simply type this videos --youtube-skip-dash-manifest Do not download the DASH manifests and related data on YouTube videos + --youtube-skip-hls-manifest Do not download the HLS manifests and + related data on YouTube videos --merge-output-format FORMAT If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, @@ -453,3 +468,5 @@ Then simply type this --convert-subs FORMAT Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc) +## Extractor Options: + --ignore-dynamic-mpd Do not process dynamic DASH manifests \ No newline at end of file diff --git a/youtube_dlc/__init__.py b/youtube_dlc/__init__.py index 13b658eff..f944cd70f 100644 --- a/youtube_dlc/__init__.py +++ b/youtube_dlc/__init__.py @@ -414,7 +414,9 @@ def _real_main(argv=None): 'prefer_ffmpeg': opts.prefer_ffmpeg, 'include_ads': opts.include_ads, 'default_search': opts.default_search, + 'dynamic_mpd': opts.dynamic_mpd, 'youtube_include_dash_manifest': opts.youtube_include_dash_manifest, + 'youtube_include_hls_manifest': opts.youtube_include_hls_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, 'mark_watched': opts.mark_watched, diff --git a/youtube_dlc/extractor/common.py b/youtube_dlc/extractor/common.py index c1ea5d846..310229d57 100644 --- a/youtube_dlc/extractor/common.py +++ b/youtube_dlc/extractor/common.py @@ -2071,8 +2071,9 @@ class InfoExtractor(object): http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip 2. https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP """ - if mpd_doc.get('type') == 'dynamic': - return [] + if not self._downloader.params.get('dynamic_mpd'): + if mpd_doc.get('type') == 'dynamic': + return [] namespace = self._search_regex(r'(?i)^{([^}]+)?}MPD$', mpd_doc.tag, 'namespace', default=None) diff --git a/youtube_dlc/extractor/youtube.py b/youtube_dlc/extractor/youtube.py index 1c1937721..d781c35b5 100644 --- a/youtube_dlc/extractor/youtube.py +++ b/youtube_dlc/extractor/youtube.py @@ -2244,7 +2244,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor): a_format['player_url'] = player_url # Accept-Encoding header causes failures in live streams on Youtube and Youtube Gaming a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True' - formats.append(a_format) + if self._downloader.params.get('youtube_include_hls_manifest', True): + formats.append(a_format) else: error_message = extract_unavailable_message() if not error_message: diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py index ea372dd6d..e6873c703 100644 --- a/youtube_dlc/options.py +++ b/youtube_dlc/options.py @@ -414,6 +414,14 @@ def parseOpts(overrideArguments=None): '--youtube-skip-dash-manifest', action='store_false', dest='youtube_include_dash_manifest', help='Do not download the DASH manifests and related data on YouTube videos') + video_format.add_option( + '--youtube-include-hls-manifest', + action='store_true', dest='youtube_include_hls_manifest', default=True, + help=optparse.SUPPRESS_HELP) + video_format.add_option( + '--youtube-skip-hls-manifest', + action='store_false', dest='youtube_include_hls_manifest', + help='Do not download the HLS manifests and related data on YouTube videos') video_format.add_option( '--merge-output-format', action='store', dest='merge_output_format', metavar='FORMAT', default=None, @@ -863,6 +871,16 @@ def parseOpts(overrideArguments=None): metavar='FORMAT', dest='convertsubtitles', default=None, help='Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc)') + extractor = optparse.OptionGroup(parser, 'Extractor Options') + extractor.add_option( + '--allow-dynamic-mpd', + action='store_true', dest='dynamic_mpd', default=True, + help=optparse.SUPPRESS_HELP) + extractor.add_option( + '--ignore-dynamic-mpd', + action='store_false', dest='dynamic_mpd', + help='Do not process dynamic DASH manifests') + parser.add_option_group(general) parser.add_option_group(network) parser.add_option_group(geo) @@ -877,6 +895,7 @@ def parseOpts(overrideArguments=None): parser.add_option_group(authentication) parser.add_option_group(adobe_pass) parser.add_option_group(postproc) + parser.add_option_group(extractor) if overrideArguments is not None: opts, args = parser.parse_args(overrideArguments)