[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
This commit is contained in:
prowlguru
2025-04-21 21:45:03 +02:00
committed by Mike Fährmann
parent abf39b60ef
commit 6306b110fd

View File

@@ -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(