From 4641937ca39b4820ed0d3a7c3f579e5bbb9b4664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 11 Feb 2024 18:41:02 +0100 Subject: [PATCH] [imagetwist] add 'gallery' extractor (#5190) --- docs/supportedsites.md | 2 +- gallery_dl/extractor/imagehosts.py | 17 +++++++++++++++++ test/results/imagetwist.py | 12 ++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 1865f82e..6e05898a 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -364,7 +364,7 @@ Consider all listed sites to potentially be NSFW. Imagetwist https://imagetwist.com/ - individual Images + Galleries, individual Images diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 94019bd6..5f1e0f48 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -183,6 +183,23 @@ class ImagetwistImageExtractor(ImagehostImageExtractor): return url, filename +class ImagetwistGalleryExtractor(ImagehostImageExtractor): + """Extractor for galleries from imagetwist.com""" + category = "imagetwist" + subcategory = "gallery" + pattern = (r"(?:https?://)?((?:www\.|phun\.)?" + r"image(?:twist|haha)\.com/(p/[^/?#]+/\d+))") + example = "https://imagetwist.com/p/USER/12345/NAME" + + def items(self): + data = {"_extractor": ImagetwistImageExtractor} + root = self.page_url[:self.page_url.find("/", 8)] + page = self.request(self.page_url).text + gallery = text.extr(page, 'class="gallerys', "