aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xyoutube_dl/YoutubeDL.py6
-rw-r--r--youtube_dl/__init__.py1
-rw-r--r--youtube_dl/extractor/generic.py4
-rw-r--r--youtube_dl/options.py4
4 files changed, 14 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index b1f792d4e..4b801a917 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -139,6 +139,7 @@ class YoutubeDL(object):
outtmpl: Template for output names.
restrictfilenames: Do not allow "&" and spaces in file names
ignoreerrors: Do not stop on download errors.
+ force_generic_extractor: Force downloader to use the generic extractor
nooverwrites: Prevent overwriting files.
playliststart: Playlist item to start at.
playlistend: Playlist item to end at.
@@ -282,6 +283,7 @@ class YoutubeDL(object):
self._num_downloads = 0
self._screen_file = [sys.stdout, sys.stderr][params.get('logtostderr', False)]
self._err_file = sys.stderr
+ self._force_generic_extractor_required = params.get('force_generic_extractor', False)
self.params = params
self.cache = Cache(self)
@@ -633,6 +635,10 @@ class YoutubeDL(object):
extra_info is a dict containing the extra values to add to each result
'''
+ if not ie_key and self._force_generic_extractor_required:
+ self._force_generic_extractor_required = False
+ ie_key = 'Generic'
+
if ie_key:
ies = [self.get_info_extractor(ie_key)]
else:
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index ace17857c..215b616de 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -293,6 +293,7 @@ def _real_main(argv=None):
'autonumber_size': opts.autonumber_size,
'restrictfilenames': opts.restrictfilenames,
'ignoreerrors': opts.ignoreerrors,
+ 'force_generic_extractor': opts.force_generic_extractor,
'ratelimit': opts.ratelimit,
'nooverwrites': opts.nooverwrites,
'retries': opts_retries,
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index 40d869c53..3d672197c 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -977,7 +977,9 @@ class GenericIE(InfoExtractor):
'upload_date': upload_date,
}
- if not self._downloader.params.get('test', False) and not is_intentional:
+ if (not self._downloader.params.get('test', False) and
+ not is_intentional and
+ not self._downloader.params.get('force_generic_extractor', False)):
self._downloader.report_warning('Falling back on generic information extractor.')
if not full_response:
diff --git a/youtube_dl/options.py b/youtube_dl/options.py
index 689fa7595..096ab6137 100644
--- a/youtube_dl/options.py
+++ b/youtube_dl/options.py
@@ -151,6 +151,10 @@ def parseOpts(overrideArguments=None):
action='store_true', dest='list_extractor_descriptions', default=False,
help='Output descriptions of all supported extractors')
general.add_option(
+ '--force-generic-extractor',
+ action='store_true', dest='force_generic_extractor', default=False,
+ help='Force extraction to use the generic extractor')
+ general.add_option(
'--default-search',
dest='default_search', metavar='PREFIX',
help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". Use the value "auto" to let youtube-dl guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching.')