mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-23 08:09:48 -05:00
fix: return ie_result and cleanup variable names to properly represent hop depth instead of redirects
This commit is contained in:
parent
a250eb2b68
commit
493587ca2c
@ -117,24 +117,24 @@ def _build_youtube_dl(worker, destdir, site, page):
|
||||
def process_ie_result(self, ie_result, download=True, extra_info=None):
|
||||
if extra_info is None:
|
||||
extra_info = {}
|
||||
if (
|
||||
"redirect_count" in extra_info
|
||||
and "_type" in ie_result
|
||||
and ie_result.get("_type") in ("url", "url_transparent")
|
||||
):
|
||||
result_type = ie_result.get("_type", "video")
|
||||
|
||||
if result_type in ("url", "url_transparent"):
|
||||
if "extraction_depth" in extra_info:
|
||||
self.logger.info(
|
||||
f"Following redirect URL: {ie_result['url']} redirect_count: {extra_info['redirect_count']}"
|
||||
f"Following redirect URL: {ie_result['url']} extraction_depth: {extra_info['extraction_depth']}"
|
||||
)
|
||||
extra_info["extraction_depth"] = 1 + extra_info.get(
|
||||
"extraction_depth", 0
|
||||
)
|
||||
extra_info["redirect_count"] = 1 + extra_info.get("redirect_count", 0)
|
||||
else:
|
||||
extra_info["redirect_count"] = 0
|
||||
if extra_info["redirect_count"] > YTDLP_MAX_REDIRECTS:
|
||||
extra_info["extraction_depth"] = 0
|
||||
if extra_info["extraction_depth"] >= YTDLP_MAX_REDIRECTS:
|
||||
raise ExtractorError(
|
||||
f"Too many redirects for URL: {ie_result['url']}",
|
||||
f"Too many hops for URL: {ie_result['url']}",
|
||||
expected=True,
|
||||
)
|
||||
|
||||
super().process_ie_result(ie_result, download, extra_info)
|
||||
return super().process_ie_result(ie_result, download, extra_info)
|
||||
|
||||
def add_default_extra_info(self, ie_result, ie, url):
|
||||
# hook in some logging
|
||||
|
Loading…
x
Reference in New Issue
Block a user