[pixiv] simplify main loop
This commit is contained in:
@@ -36,13 +36,6 @@ class PixivExtractor(Extractor):
|
|||||||
for work in self.works():
|
for work in self.works():
|
||||||
work = self.prepare_work(work)
|
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 work["type"] == "ugoira":
|
||||||
if not self.load_ugoira:
|
if not self.load_ugoira:
|
||||||
continue
|
continue
|
||||||
@@ -56,21 +49,10 @@ class PixivExtractor(Extractor):
|
|||||||
yield Message.Url, work["url"], work
|
yield Message.Url, work["url"], work
|
||||||
|
|
||||||
else:
|
else:
|
||||||
url = work["url"]
|
url, _, ext = work["url"].rpartition("_p0")
|
||||||
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 = ""
|
|
||||||
for i in range(work["page_count"]):
|
for i in range(work["page_count"]):
|
||||||
work["num"] = "_p{:02}".format(i)
|
work["num"] = "_p{:02}".format(i)
|
||||||
url = "{}{}_p{}.{}{}".format(
|
yield Message.Url, "{}_p{}{}".format(url, i, ext), work
|
||||||
url[:off], big, i, ext, timestamp
|
|
||||||
)
|
|
||||||
yield Message.Url, url, work
|
|
||||||
|
|
||||||
def works(self):
|
def works(self):
|
||||||
"""Return all work-items for a pixiv-member"""
|
"""Return all work-items for a pixiv-member"""
|
||||||
|
|||||||
Reference in New Issue
Block a user