|
|
|
@ -1822,17 +1822,17 @@ class YoutubeDL:
|
|
|
|
|
result_type = ie_result.get('_type', 'video')
|
|
|
|
|
|
|
|
|
|
if result_type in ('url', 'url_transparent'):
|
|
|
|
|
if 'extraction_depth' in extra_info:
|
|
|
|
|
extra_info['extraction_depth'] = 1 + extra_info.get('extraction_depth', 0)
|
|
|
|
|
else:
|
|
|
|
|
extra_info['extraction_depth'] = 0
|
|
|
|
|
if self.params.get('max_extraction_depth', -1) > 0:
|
|
|
|
|
if 'extraction_depth' in extra_info:
|
|
|
|
|
extra_info['extraction_depth'] = 1 + extra_info.get('extraction_depth', 0)
|
|
|
|
|
else:
|
|
|
|
|
extra_info['extraction_depth'] = 0
|
|
|
|
|
|
|
|
|
|
# TODO: make command line arg with large or infinite default
|
|
|
|
|
if extra_info['extraction_depth'] >= 20:
|
|
|
|
|
raise ExtractorError(
|
|
|
|
|
f"Too many hops for URL: {ie_result['url']}",
|
|
|
|
|
expected=True,
|
|
|
|
|
)
|
|
|
|
|
if extra_info['extraction_depth'] >= self.params.get('max_extraction_depth'):
|
|
|
|
|
raise ExtractorError(
|
|
|
|
|
f"Reached maximum extraction depth for URL: {ie_result['url']}",
|
|
|
|
|
expected=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
ie_result['url'] = sanitize_url(
|
|
|
|
|
ie_result['url'], scheme='http' if self.params.get('prefer_insecure') else 'https')
|
|
|
|
|