Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: increase number of max redirects (#1442)

NTFSvolumebbe4840fd114
diff --git a/cyberdrop_dl/constants.py b/cyberdrop_dl/constants.py
index 0e9ba8672..74435e570 100644
--- a/cyberdrop_dl/constants.py
+++ b/cyberdrop_dl/constants.py
@@ -21,7 +21,7 @@ LOGS_DATE_FORMAT = "%Y_%m_%d"
STARTUP_TIME_STR = STARTUP_TIME.strftime(LOGS_DATETIME_FORMAT)
STARTUP_TIME_UTC_STR = STARTUP_TIME_UTC.strftime(LOGS_DATETIME_FORMAT)
DNS_RESOLVER: type[AsyncResolver] | type[ThreadedResolver] | None = None
-MAX_REDIRECTS: Final[int] = 3
+MAX_REDIRECTS: Final[int] = 8
# logging
diff --git a/cyberdrop_dl/utils/utilities.py b/cyberdrop_dl/utils/utilities.py
index 880d89026..7d8cb6590 100644
--- a/cyberdrop_dl/utils/utilities.py
+++ b/cyberdrop_dl/utils/utilities.py
@@ -4,7 +4,6 @@ import contextlib
import dataclasses
import inspect
import itertools
-import json
import os
import platform
import re
@@ -28,7 +27,7 @@ from typing import (
overload,
)
-from aiohttp import ClientConnectorError
+from aiohttp import ClientConnectorError, TooManyRedirects
from pydantic import ValidationError
from yarl import URL
@@ -44,6 +43,7 @@ from cyberdrop_dl.exceptions import (
create_error_msg,
get_origin,
)
+from cyberdrop_dl.utils import json
from cyberdrop_dl.utils.logger import log, log_with_color
if TYPE_CHECKING:
@@ -87,6 +87,10 @@ def error_handling_context(self: Crawler | Downloader, item: ScrapeItem | MediaI
except NotImplementedError as e:
error_log_msg = ErrorLogMessage("NotImplemented")
exc_info = e
+ except TooManyRedirects as e:
+ ui_failure = "Too Many Redirects"
+ info = json.dumps({"url": e.request_info.real_url, "history": [r.real_url for r in e.history]}, indent=4)
+ error_log_msg = ErrorLogMessage(ui_failure, f"{ui_failure}\n{info}")
except TimeoutError as e:
error_log_msg = ErrorLogMessage("Timeout", repr(e))
except ClientConnectorError as e: