From 556fbb1a44759882c416a22ca2d135a4a550a5c0 Mon Sep 17 00:00:00 2001 From: arebokert Date: Sat, 18 Jan 2025 17:19:29 +0100 Subject: [PATCH] [turboimagehost] add support for galleries - added support - raise error if gallery not found - fix test - fix lint issues - simplify --- docs/supportedsites.md | 2 +- gallery_dl/extractor/imagehosts.py | 28 ++++++++++++++++++++++++++++ test/results/turboimagehost.py | 10 ++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index e55e868a84..9f37f6eb77 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -958,7 +958,7 @@ Consider all listed sites to potentially be NSFW. Turboimagehost https://www.turboimagehost.com/ - individual Images + Galleries, individual Images diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 5f1e0f4852..d6b36cb517 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -286,6 +286,34 @@ def get_info(self, page): return url, url +class TurboimagehostGalleryExtractor(ImagehostImageExtractor): + """Extractor for image galleries from turboimagehost.com""" + category = "turboimagehost" + subcategory = "gallery" + pattern = (r"(?:https?://)?((?:www\.)?turboimagehost\.com" + r"/album/(\d+)/([^/?#]*))") + example = "https://www.turboimagehost.com/album/12345/GALLERY_NAME" + + def items(self): + data = {"_extractor": TurboimagehostImageExtractor} + params = {"p": 1} + + while True: + page = self.request(self.page_url, params=params).text + + if params["p"] == 1 and \ + "Requested gallery don`t exist on our website." in page: + raise exception.NotFoundError("gallery") + + thumb_url = None + for thumb_url in text.extract_iter(page, '">