[tumblr:search] prevent KeyError when using 'offset' pagination (#8720)

This commit is contained in:
Mike Fährmann
2025-12-29 16:57:04 +01:00
parent ebfd87bbb0
commit ec2267244f

View File

@@ -531,12 +531,16 @@ class TumblrAPI(oauth.OAuth1API):
if self.api_key:
params["api_key"] = self.api_key
strategy = self.extractor.config("pagination")
if not strategy:
if params.get("before"):
strategy = "before"
elif "offset" not in params:
if strategy := self.extractor.config("pagination"):
if strategy not in {"api", "before"} and "offset" not in params:
self.log.warning('Unable to use "pagination": "%s". '
'Falling back to "api".', strategy)
strategy = "api"
elif params.get("before"):
strategy = "before"
elif "offset" not in params:
strategy = "api"
self.log.debug("Pagination strategy '%s'", strategy or "offset")
while True:
data = self._call(endpoint, params)