From 6306b110fd72ba51dc884a731ac71d8229b1392b Mon Sep 17 00:00:00 2001 From: prowlguru <183935626+prowlguru@users.noreply.github.com> Date: Mon, 21 Apr 2025 21:45:03 +0200 Subject: [PATCH] [pixiv] fix 'user_details' requests not being cached Calls to user_detail would sometimes have an integer user_id and sometimes string. Since this is used as a key for caching this function, it would cause an extra request to be made. All calls to user_detail should be sending user_id as a string, to avoid having multiple entries in the cache, causing an extra request to be made. Authored by: prowlguru --- gallery_dl/extractor/pixiv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 42ab1c74..8ddae0c2 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -69,7 +69,7 @@ class PixivExtractor(Extractor): files = self._extract_files(work) if self.meta_user: - work.update(self.api.user_detail(work["user"]["id"])) + work.update(self.api.user_detail(str(work["user"]["id"]))) if self.meta_comments: if work["total_comments"] and not work.get("_ajax"): try: @@ -881,7 +881,7 @@ class PixivNovelExtractor(PixivExtractor): novels = itertools.islice(novels, self.max_posts) for novel in novels: if self.meta_user: - novel.update(self.api.user_detail(novel["user"]["id"])) + novel.update(self.api.user_detail(str(novel["user"]["id"]))) if self.meta_comments: if novel["total_comments"]: novel["comments"] = list(