diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 510f0cbae..79f8b2a10 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1822,15 +1822,15 @@ def process_ie_result(self, ie_result, download=True, extra_info=None): result_type = ie_result.get('_type', 'video') if result_type in ('url', 'url_transparent'): - if 'redirect_count' in extra_info: - extra_info['redirect_count'] = 1 + extra_info.get('redirect_count', 0) + if 'extraction_depth' in extra_info: + extra_info['extraction_depth'] = 1 + extra_info.get('extraction_depth', 0) else: - extra_info['redirect_count'] = 0 + extra_info['extraction_depth'] = 0 # TODO: make command line arg with large or infinite default - if extra_info['redirect_count'] >= 5: + if extra_info['extraction_depth'] >= 20: raise ExtractorError( - f"Too many redirects for URL: {ie_result['url']}", + f"Too many hops for URL: {ie_result['url']}", expected=True, )