diff options
| author | 2024-01-08 03:22:24 -0500 | |
|---|---|---|
| committer | 2024-01-08 03:22:24 -0500 | |
| commit | e949aaf6f6ac93896947d5b736e48e7911926efb (patch) | |
| tree | b73090d78cd83dee0f85b385a25dcf623ac12f2d /gallery_dl/extractor/zzup.py | |
| parent | 4d7a4f1ecef2c96269f3590335d2834ebcdd50bf (diff) | |
New upstream version 1.26.6.upstream/1.26.6
Diffstat (limited to 'gallery_dl/extractor/zzup.py')
| -rw-r--r-- | gallery_dl/extractor/zzup.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gallery_dl/extractor/zzup.py b/gallery_dl/extractor/zzup.py new file mode 100644 index 0000000..45b0cd8 --- /dev/null +++ b/gallery_dl/extractor/zzup.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +from .common import GalleryExtractor +from .. import text + + +class ZzupGalleryExtractor(GalleryExtractor): + category = "zzup" + directory_fmt = ("{category}", "{title}") + filename_fmt = "{slug}_{num:>03}.{extension}" + archive_fmt = "{slug}_{num}" + root = "https://zzup.com" + pattern = (r"(?:https?://)?(?:www\.)?zzup\.com(/content" + r"/[\w=]+/([^/?#]+)/[\w=]+)/(?:index|page-\d+)\.html") + example = "https://zzup.com/content/xyz=/12345_TITLE/123=/index.html" + + def __init__(self, match): + url = "{}/{}/index.html".format(self.root, match.group(1)) + GalleryExtractor.__init__(self, match, url) + self.slug = match.group(2) + + def metadata(self, page): + return { + "slug" : self.slug, + "title": text.unescape(text.extr( + page, "<title>", "</title>"))[:-11], + } + + def images(self, page): + path = text.extr(page, 'class="picbox"><a target="_blank" href="', '"') + count = text.parse_int(text.extr(path, "-pics-", "-mirror")) + page = self.request(self.root + path).text + url = self.root + text.extr(page, '\n<a href="', '"') + p1, _, p2 = url.partition("/image0") + ufmt = p1 + "/image{:>05}" + p2[4:] + return [(ufmt.format(num), None) for num in range(1, count + 1)] |
