diff --git a/gallery_dl/extractor/lofter.py b/gallery_dl/extractor/lofter.py index 412b6b9fbb8..b92a6fffafa 100644 --- a/gallery_dl/extractor/lofter.py +++ b/gallery_dl/extractor/lofter.py @@ -23,6 +23,8 @@ def _init(self): def items(self): for post in self.posts(): + if post is None: + continue if "post" in post: post = post["post"] @@ -129,6 +131,9 @@ def _call(self, endpoint, data): url, method="POST", params=params, data=data) info = response.json() + if info["meta"]["status"] == 4200: + raise exception.NotFoundError("blog") + if info["meta"]["status"] != 200: self.extractor.log.debug("Server response: %s", info) raise exception.StopExtraction("API request failed") @@ -142,6 +147,9 @@ def _pagination(self, endpoint, params): yield from posts + if data["offset"] < 0: + break + if params["offset"] + len(posts) < data["offset"]: break params["offset"] = data["offset"]