add "--no-generic-extractor" flag which excludes usage of the generic extractor when processing a url.
This commit is contained in:
parent
134c6ea856
commit
33a4446c89
@ -150,6 +150,7 @@ class YoutubeDL(object):
|
|||||||
restrictfilenames: Do not allow "&" and spaces in file names
|
restrictfilenames: Do not allow "&" and spaces in file names
|
||||||
ignoreerrors: Do not stop on download errors.
|
ignoreerrors: Do not stop on download errors.
|
||||||
force_generic_extractor: Force downloader to use the generic extractor
|
force_generic_extractor: Force downloader to use the generic extractor
|
||||||
|
no_generic_extractor: Prevent usage of the generic extractor
|
||||||
nooverwrites: Prevent overwriting files.
|
nooverwrites: Prevent overwriting files.
|
||||||
playliststart: Playlist item to start at.
|
playliststart: Playlist item to start at.
|
||||||
playlistend: Playlist item to end at.
|
playlistend: Playlist item to end at.
|
||||||
@ -648,7 +649,7 @@ class YoutubeDL(object):
|
|||||||
info_dict.setdefault(key, value)
|
info_dict.setdefault(key, value)
|
||||||
|
|
||||||
def extract_info(self, url, download=True, ie_key=None, extra_info={},
|
def extract_info(self, url, download=True, ie_key=None, extra_info={},
|
||||||
process=True, force_generic_extractor=False):
|
process=True, force_generic_extractor=False, no_generic_extractor=False):
|
||||||
'''
|
'''
|
||||||
Returns a list with a dictionary for each video we find.
|
Returns a list with a dictionary for each video we find.
|
||||||
If 'download', also downloads the videos.
|
If 'download', also downloads the videos.
|
||||||
@ -664,6 +665,8 @@ class YoutubeDL(object):
|
|||||||
ies = self._ies
|
ies = self._ies
|
||||||
|
|
||||||
for ie in ies:
|
for ie in ies:
|
||||||
|
if(ie.ie_key() == "Generic" and no_generic_extractor):
|
||||||
|
continue
|
||||||
if not ie.suitable(url):
|
if not ie.suitable(url):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -1733,7 +1736,9 @@ class YoutubeDL(object):
|
|||||||
try:
|
try:
|
||||||
# It also downloads the videos
|
# It also downloads the videos
|
||||||
res = self.extract_info(
|
res = self.extract_info(
|
||||||
url, force_generic_extractor=self.params.get('force_generic_extractor', False))
|
url,
|
||||||
|
force_generic_extractor=self.params.get('force_generic_extractor', False),
|
||||||
|
no_generic_extractor=self.params.get('no_generic_extractor', False))
|
||||||
except UnavailableVideoError:
|
except UnavailableVideoError:
|
||||||
self.report_error('unable to download video')
|
self.report_error('unable to download video')
|
||||||
except MaxDownloadsReached:
|
except MaxDownloadsReached:
|
||||||
|
@ -305,6 +305,7 @@ def _real_main(argv=None):
|
|||||||
'restrictfilenames': opts.restrictfilenames,
|
'restrictfilenames': opts.restrictfilenames,
|
||||||
'ignoreerrors': opts.ignoreerrors,
|
'ignoreerrors': opts.ignoreerrors,
|
||||||
'force_generic_extractor': opts.force_generic_extractor,
|
'force_generic_extractor': opts.force_generic_extractor,
|
||||||
|
'no_generic_extractor': opts.no_generic_extractor,
|
||||||
'ratelimit': opts.ratelimit,
|
'ratelimit': opts.ratelimit,
|
||||||
'nooverwrites': opts.nooverwrites,
|
'nooverwrites': opts.nooverwrites,
|
||||||
'retries': opts.retries,
|
'retries': opts.retries,
|
||||||
|
@ -154,6 +154,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
'--force-generic-extractor',
|
'--force-generic-extractor',
|
||||||
action='store_true', dest='force_generic_extractor', default=False,
|
action='store_true', dest='force_generic_extractor', default=False,
|
||||||
help='Force extraction to use the generic extractor')
|
help='Force extraction to use the generic extractor')
|
||||||
|
general.add_option(
|
||||||
|
'--no-generic-extractor',
|
||||||
|
action='store_true', dest='no_generic_extractor', default=False,
|
||||||
|
help='prevent extraction from using the generic extractor')
|
||||||
general.add_option(
|
general.add_option(
|
||||||
'--default-search',
|
'--default-search',
|
||||||
dest='default_search', metavar='PREFIX',
|
dest='default_search', metavar='PREFIX',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user