aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-06-12 19:20:12 +0600
committerSergey M․ <dstftw@gmail.com>2015-06-12 19:20:12 +0600
commitd22dec74ffa2a53a1c04770af37d39f384f3d56c (patch)
tree63d827c74e252e7c7b00cca57e0e008b72b6a9d2 /youtube_dl/YoutubeDL.py
parent9872d3110c0d3027dac856e005299f3682ef23ed (diff)
Add `--force-generic-extractor`
For some extractors that are hard to workout a good _VALID_URL we use very vague and unrestrictive ones, e.g. just allowing anything after hostname and capturing part of URL as id. If some of these extractors happen to have an video embed of some different hoster or platform and this scenario was not handled in extractor itself we end up with inability to download this embed until extractor is fixed to support embed of this kind. Forcing downloader to use the generic extractor can be a neat temporary solution for this problem. Example: FiveTV extractor with Tvigle embed - http://www.5-tv.ru/rabota/broadcasts/48/
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py6
1 files changed, 6 insertions, 0 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: