summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/pixiv.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2024-12-08 20:34:33 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2024-12-08 20:34:33 -0500
commitf6877087773089220d68288d055276fca6c556d4 (patch)
treee4847e3bcff284c3daece7b3b9cf308dfc2129ab /gallery_dl/extractor/pixiv.py
parent1981ccaaea6eab2cf32536ec5afe132a870914d8 (diff)
New upstream version 1.28.1.upstream/1.28.1
Diffstat (limited to 'gallery_dl/extractor/pixiv.py')
-rw-r--r--gallery_dl/extractor/pixiv.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py
index 8ad061d..6207bf7 100644
--- a/gallery_dl/extractor/pixiv.py
+++ b/gallery_dl/extractor/pixiv.py
@@ -380,8 +380,9 @@ class PixivArtworksExtractor(PixivExtractor):
ajax_ids.extend(map(int, body["manga"]))
ajax_ids.sort()
except Exception as exc:
- self.log.warning("Unable to collect artwork IDs using AJAX "
- "API (%s: %s)", exc.__class__.__name__, exc)
+ self.log.warning("u%s: Failed to collect artwork IDs "
+ "using AJAX API (%s: %s)",
+ self.user_id, exc.__class__.__name__, exc)
else:
works = self._extend_sanity(works, ajax_ids)
@@ -607,8 +608,12 @@ class PixivRankingExtractor(PixivExtractor):
def works(self):
ranking = self.ranking
- for ranking["rank"], work in enumerate(
- self.api.illust_ranking(self.mode, self.date), 1):
+
+ works = self.api.illust_ranking(self.mode, self.date)
+ if self.type:
+ works = filter(lambda work, t=self.type: work["type"] == t, works)
+
+ for ranking["rank"], work in enumerate(works, 1):
yield work
def metadata(self):
@@ -648,10 +653,13 @@ class PixivRankingExtractor(PixivExtractor):
date = (now - timedelta(days=1)).strftime("%Y-%m-%d")
self.date = date
+ self.type = type = query.get("content")
+
self.ranking = ranking = {
"mode": mode,
"date": self.date,
"rank": 0,
+ "type": type or "all",
}
return {"ranking": ranking}