Skip to content

Commit

Permalink
[danbooru] improve 75666cf (#4002)
Browse files Browse the repository at this point in the history
Search for direct post IDs instead of trying to
replicate the same results as the initial request.
  • Loading branch information
mikf committed May 14, 2023
1 parent e41e45f commit fd0e1ff
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gallery_dl/extractor/danbooru.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ def _pagination(self, endpoint, params, pages=False):
posts = posts["posts"]

if self.includes and posts:
if not pages and "only" not in params:
params["page"] = "b{}".format(posts[0]["id"] + 1)
params["only"] = self.includes
params_meta = {
"only" : self.includes,
"limit": len(posts),
"tags" : "id:" + ",".join(str(p["id"]) for p in posts),
}
data = {
meta["id"]: meta
for meta in self.request(url, params=params).json()
for meta in self.request(url, params=params_meta).json()
}
for post in posts:
post.update(data[post["id"]])
params["only"] = None

yield from posts

Expand Down Expand Up @@ -155,7 +156,7 @@ def _ugoira_frames(self, post):
"aibooru": {
"root": None,
"pattern": r"(?:safe.)?aibooru\.online",
}
},
})


Expand Down

0 comments on commit fd0e1ff

Please sign in to comment.