diff --git a/docs/configuration.rst b/docs/configuration.rst index d6a8fb4c263..ddce4f88321 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2403,6 +2403,27 @@ Description You can use ``"all"`` instead of listing all types separately. +extractor.tumblr.fallback-delay +------------------------------- +Type + ``float`` +Default + ``120.0`` +Description + Number of seconds to wait between retries + for fetching full-resolution images. + + +extractor.tumblr.fallback-retries +--------------------------------- +Type + ``integer`` +Default + ``2`` +Description + Number of retries for fetching full-resolution images. + + extractor.twibooru.api-key -------------------------- Type diff --git a/gallery_dl/extractor/tumblr.py b/gallery_dl/extractor/tumblr.py index 324a3c6ef37..5451f6e0d69 100644 --- a/gallery_dl/extractor/tumblr.py +++ b/gallery_dl/extractor/tumblr.py @@ -49,6 +49,8 @@ def __init__(self, match): self.reblogs = self.config("reblogs", True) self.external = self.config("external", False) self.original = self.config("original", True) + self.fallback_delay = self.config("fallback-delay", 120.0) + self.fallback_retries = self.config("fallback-retries", 2) if len(self.types) == 1: self.api.posts_type = next(iter(self.types)) @@ -250,8 +252,8 @@ def _update_image_token(self, resized): return updated, (resized == updated) def _original_image_fallback(self, url, post_id): - for _ in range(3): - self.sleep(120, "image token") + for _ in range(self.fallback_retries): + self.sleep(self.fallback_delay, "image token") yield self._update_image_token(url)[0] self.log.warning("Unable to fetch higher-resolution " "version of %s (%s)", url, post_id)