From c24e0e70a7a1357d0e06acee6bf36b96eb85bac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 28 Dec 2017 14:13:39 +0100 Subject: [PATCH] [pixiv] simplify main loop --- gallery_dl/extractor/pixiv.py | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 941a094f..b44d8579 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -36,13 +36,6 @@ class PixivExtractor(Extractor): for work in self.works(): work = self.prepare_work(work) - pos = work["extension"].rfind("?", -18) - if pos != -1: - timestamp = work["extension"][pos:] - work["extension"] = work["extension"][:pos] - else: - timestamp = "" - if work["type"] == "ugoira": if not self.load_ugoira: continue @@ -56,21 +49,10 @@ class PixivExtractor(Extractor): yield Message.Url, work["url"], work else: - url = work["url"] - ext = work["extension"] - off = url.rfind(".") - if url[off-2] == "p": - off -= 3 - if work["id"] > 11319935 and "/img-original/" not in url: - big = "_big" - else: - big = "" + url, _, ext = work["url"].rpartition("_p0") for i in range(work["page_count"]): work["num"] = "_p{:02}".format(i) - url = "{}{}_p{}.{}{}".format( - url[:off], big, i, ext, timestamp - ) - yield Message.Url, url, work + yield Message.Url, "{}_p{}{}".format(url, i, ext), work def works(self): """Return all work-items for a pixiv-member""" @@ -301,9 +283,9 @@ class PixivRankingExtractor(PixivExtractor): self.date = None if self.content not in ("all", "illust", "manga", "ugoira"): - self.log.warning("unrecognized content value '%s' - " - "falling back to 'all'", self.content) - self.content = "all" + self.log.warning("unrecognized content value '%s' - " + "falling back to 'all'", self.content) + self.content = "all" def works(self): yield from self._first["works"]