1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-03-09 12:50:23 -05:00

chore: refactor attribute naming. This is currently representing something closer to depth of extraction, and not redirects.

This commit is contained in:
Adam Miller 2025-01-08 16:44:22 -08:00
parent 6cd95babef
commit 050b6c1f29

View file

@ -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,
)