|
|
@ -14,6 +14,7 @@ from ..utils import (
|
|
|
|
clean_html,
|
|
|
|
clean_html,
|
|
|
|
compiled_regex_type,
|
|
|
|
compiled_regex_type,
|
|
|
|
ExtractorError,
|
|
|
|
ExtractorError,
|
|
|
|
|
|
|
|
RegexNotFoundError,
|
|
|
|
unescapeHTML,
|
|
|
|
unescapeHTML,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -231,7 +232,7 @@ class InfoExtractor(object):
|
|
|
|
Perform a regex search on the given string, using a single or a list of
|
|
|
|
Perform a regex search on the given string, using a single or a list of
|
|
|
|
patterns returning the first matching group.
|
|
|
|
patterns returning the first matching group.
|
|
|
|
In case of failure return a default value or raise a WARNING or a
|
|
|
|
In case of failure return a default value or raise a WARNING or a
|
|
|
|
ExtractorError, depending on fatal, specifying the field name.
|
|
|
|
RegexNotFoundError, depending on fatal, specifying the field name.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
if isinstance(pattern, (str, compat_str, compiled_regex_type)):
|
|
|
|
if isinstance(pattern, (str, compat_str, compiled_regex_type)):
|
|
|
|
mobj = re.search(pattern, string, flags)
|
|
|
|
mobj = re.search(pattern, string, flags)
|
|
|
@ -251,7 +252,7 @@ class InfoExtractor(object):
|
|
|
|
elif default is not None:
|
|
|
|
elif default is not None:
|
|
|
|
return default
|
|
|
|
return default
|
|
|
|
elif fatal:
|
|
|
|
elif fatal:
|
|
|
|
raise ExtractorError(u'Unable to extract %s' % _name)
|
|
|
|
raise RegexNotFoundError(u'Unable to extract %s' % _name)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self._downloader.report_warning(u'unable to extract %s; '
|
|
|
|
self._downloader.report_warning(u'unable to extract %s; '
|
|
|
|
u'please report this issue on http://yt-dl.org/bug' % _name)
|
|
|
|
u'please report this issue on http://yt-dl.org/bug' % _name)
|
|
|
|