1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-01-31 11:41:35 +01:00

[imagetwist] add 'gallery' extractor (#5190)

This commit is contained in:
Mike Fährmann 2024-02-11 18:41:02 +01:00
parent fde82ab0ce
commit 4641937ca3
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 30 additions and 1 deletions

View File

@ -364,7 +364,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Imagetwist</td>
<td>https://imagetwist.com/</td>
<td>individual Images</td>
<td>Galleries, individual Images</td>
<td></td>
</tr>
<tr>

View File

@ -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', "</div")
for path in text.extract_iter(gallery, ' href="', '"'):
yield Message.Queue, root + path, data
class ImgspiceImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from imgspice.com"""
category = "imgspice"

View File

@ -41,4 +41,16 @@ __tests__ = (
"#class" : imagehosts.ImagetwistImageExtractor,
},
{
"#url" : "https://imagetwist.com/p/gdldev/747223/digits",
"#category": ("imagehost", "imagetwist", "gallery"),
"#class" : imagehosts.ImagetwistGalleryExtractor,
"#urls" : (
"https://imagetwist.com/j6eu91sbl9bs",
"https://imagetwist.com/vx4oh119izyr",
"https://imagetwist.com/n3td3a6vzzed",
"https://imagetwist.com/8uz6lmg31nmc",
),
},
)