diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index f5f064241..2dfa40082 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -373,6 +373,7 @@ def _real_main(argv=None): 'external_downloader_args': external_downloader_args, 'postprocessor_args': postprocessor_args, 'cn_verification_proxy': opts.cn_verification_proxy, + 'skip_protocols': opts.skip_protocols, } with YoutubeDL(ydl_opts) as ydl: diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 199a04d1c..2305adcd9 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -939,6 +939,8 @@ class InfoExtractor(object): def _extract_f4m_formats(self, manifest_url, video_id, preference=None, f4m_id=None, transform_source=lambda s: fix_xml_ampersands(s).strip(), fatal=True): + if 'f4m' in self._downloader.params.get('skip_protocols'): + return [] manifest = self._download_xml( manifest_url, video_id, 'Downloading f4m manifest', 'Unable to download f4m manifest', @@ -995,6 +997,8 @@ class InfoExtractor(object): entry_protocol='m3u8', preference=None, m3u8_id=None, note=None, errnote=None, fatal=True): + if 'm3u8' in self._downloader.params.get('skip_protocols'): + return [] formats = [{ 'format_id': '-'.join(filter(None, [m3u8_id, 'meta'])), @@ -1105,6 +1109,8 @@ class InfoExtractor(object): return '/'.join(out) def _extract_smil_formats(self, smil_url, video_id, fatal=True, f4m_params=None): + if 'smil' in self._downloader.params.get('skip_protocols'): + return [] smil = self._download_smil(smil_url, video_id, fatal=fatal) if smil is False: @@ -1338,6 +1344,8 @@ class InfoExtractor(object): fatal=fatal) def _extract_dash_manifest_formats(self, dash_manifest_url, video_id, fatal=True, namespace=None, formats_dict={}): + if 'dash' in self._downloader.params.get('skip_protocols'): + return [] dash_doc = self._download_dash_manifest(dash_manifest_url, video_id, fatal) if dash_doc is False: return [] diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 2137dfb3f..b953a55c4 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -354,6 +354,11 @@ def parseOpts(overrideArguments=None): 'If a merge is required (e.g. bestvideo+bestaudio), ' 'output to given container format. One of mkv, mp4, ogg, webm, flv. ' 'Ignored if no merge is required')) + video_format.add_option( + '--skip-protocols', + action='callback', dest='skip_protocols', type='str', + default=[], callback=_comma_separated_values_options_callback, + help='Protocols to exclude from the format extraction separated by commas (Possible values: m3u8, f4m, dash and smil)') subtitles = optparse.OptionGroup(parser, 'Subtitle Options') subtitles.add_option(