From 7ed04d830e1f71f5c6137662d0eb7254ce107662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 4 Nov 2025 08:41:53 +0100 Subject: [PATCH] [postimg] force 'postimg.cc' domain (#8505) --- gallery_dl/extractor/imagehosts.py | 14 ++++++++------ scripts/supportedsites.py | 1 + test/results/postimg.py | 7 ++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 8a0064e3..f14d02ce 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -304,9 +304,10 @@ class PixhostGalleryExtractor(ImagehostImageExtractor): class PostimgImageExtractor(ImagehostImageExtractor): """Extractor for single images from postimages.org""" category = "postimg" - pattern = (r"(?:https?://)?((?:www\.)?(?:postim(?:ages|g)|pixxxels)" - r"\.(?:cc|org)/(?!gallery/)(?:image/)?([^/?#]+)/?)") - example = "https://postimages.org/ID" + root = "https://postimg.cc" + pattern = (r"(?:https?://)?(?:www\.)?(?:postim(?:ages|g)|pixxxels)" + r"\.(?:cc|org)(/(?!gallery/)(?:image/)?([^/?#]+)/?)") + example = "https://postimg.cc/ID" def get_info(self, page): pos = page.index(' id="download"') @@ -319,9 +320,10 @@ class PostimgGalleryExtractor(ImagehostImageExtractor): """Extractor for images galleries from postimages.org""" category = "postimg" subcategory = "gallery" - pattern = (r"(?:https?://)?((?:www\.)?(?:postim(?:ages|g)|pixxxels)" - r"\.(?:cc|org)/gallery/([^/?#]+))") - example = "https://postimages.org/gallery/ID" + root = "https://postimg.cc" + pattern = (r"(?:https?://)?(?:www\.)?(?:postim(?:ages|g)|pixxxels)" + r"\.(?:cc|org)(/gallery/([^/?#]+))") + example = "https://postimg.cc/gallery/ID" def items(self): page = self.request(self.page_url).text diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 3e42ad9e..5237d407 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -679,6 +679,7 @@ def build_extractor_list(): base["imgtaxi"] = base["imgdrive"] base["imgwallet"] = base["imgdrive"] categories["imagehost"] = {k: base[k] for k in sorted(base)} + domains["postimg"] = "https://postimages.org/" domains["imgtaxi"] = "https://imgtaxi.com/" domains["imgwallet"] = "https://imgwallet.com/" diff --git a/test/results/postimg.py b/test/results/postimg.py index ba4b8a86..e5b24496 100644 --- a/test/results/postimg.py +++ b/test/results/postimg.py @@ -12,6 +12,7 @@ __tests__ = ( "#url" : "https://postimages.org/Wtn2b3hC", "#category": ("imagehost", "postimg", "image"), "#class" : imagehosts.PostimgImageExtractor, + "#results" : "https://i.postimg.cc/PhJZt1Rw/test-tesuto.png?dl=1", }, { @@ -30,9 +31,13 @@ __tests__ = ( "#url" : "https://postimg.cc/Wtn2b3hC", "#category": ("imagehost", "postimg", "image"), "#class" : imagehosts.PostimgImageExtractor, - "#sha1_url" : "72f3c8b1d6c6601a20ad58f35635494b4891a99e", + "#results" : "https://i.postimg.cc/PhJZt1Rw/test-tesuto.png?dl=1", "#sha1_metadata": "2d05808d04e4e83e33200db83521af06e3147a84", "#sha1_content" : "cfaa8def53ed1a575e0c665c9d6d8cf2aac7a0ee", + + "extension": "", + "filename" : "test-ใƒ†ใ‚นใƒˆ-\"&>", + "token" : "Wtn2b3hC", }, {