From 4f535ec6069d16025ad3d58067347cc9c26905b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 28 Dec 2025 21:36:06 +0100 Subject: [PATCH] [imgpv] add 'image' extractor (#8773) --- docs/supportedsites.md | 6 +++++ gallery_dl/extractor/imagehosts.py | 25 +++++++++++++++++++ scripts/supportedsites.py | 1 + test/results/imgpv.py | 39 ++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 test/results/imgpv.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 43150f13..97b3aa90 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -2129,6 +2129,12 @@ Consider all listed sites to potentially be NSFW. individual Images + + IMGPV + https://imgpv.com/ + individual Images + + Imgspice https://imgspice.com/ diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 40af967e..d1abe014 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -485,3 +485,28 @@ class SilverpicImageExtractor(ImagehostImageExtractor): "width" : text.parse_int(width), "height": text.parse_int(height), } + + +class ImgpvImageExtractor(ImagehostImageExtractor): + """Extractor for imgpv.com images""" + category = "imgpv" + root = "https://imgpv.com" + pattern = (r"(?:https?://)?(?:www\.)?imgpv\.com" + r"(/([a-z0-9]{10,})/[\S]+\.html)") + example = "https://www.imgpv.com/a1b2c3d4f5g6/NAME.EXT.html" + + def get_info(self, page): + url, pos = text.extract(page, 'id="img-preview" src="', '"') + alt, pos = text.extract(page, 'alt="', '"', pos) + return url, text.unescape(alt) + + def metadata(self, page): + pos = page.find('class="upinfo">') + date, pos = text.extract(page, '', 'by', pos) + user, pos = text.extract(page, '>', '<', pos) + + date = date.split() + return { + "date": self.parse_datetime_iso(f"{date[0][:10]} {date[1]}"), + "user": text.unescape(user), + } diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index e12fac19..0ee42ad9 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -100,6 +100,7 @@ CATEGORY_MAP = { "imgkiwi" : "IMG.Kiwi", "imglike" : "Nude Celeb", "imgpile" : "imgpile", + "imgpv" : "IMGPV", "imgtaxi" : "ImgTaxi.com", "imgth" : "imgth", "imgur" : "imgur", diff --git a/test/results/imgpv.py b/test/results/imgpv.py new file mode 100644 index 00000000..1adcf4da --- /dev/null +++ b/test/results/imgpv.py @@ -0,0 +1,39 @@ +# -*- 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 gallery_dl.extractor import imagehosts + + +__tests__ = ( +{ + "#url" : "https://imgpv.com/30zydqn6y1yk/4bi%20(1).jpg.html", + "#category": ("imagehost", "imgpv", "image"), + "#class" : imagehosts.ImgpvImageExtractor, + "#pattern" : r"https://s1.imgpv.com/cgi-bin/dl.cgi/xyhr\w+/4bi %26%2340%3B1%26%2341%3B.jpg", + + "date" : "dt:2025-12-16 14:59:51", + "extension": "jpg", + "filename" : "4bi (1)", + "post_url" : "https://imgpv.com/30zydqn6y1yk/4bi%20(1).jpg.html", + "token" : "30zydqn6y1yk", + "user" : "kris85", +}, + +{ + "#url" : "https://imgpv.com/4sizkvumyh8v/test-%E3%83%86%E3%82%B9%E3%83%88-%22%2526%3E.jpg.html", + "#category": ("imagehost", "imgpv", "image"), + "#class" : imagehosts.ImgpvImageExtractor, + "#pattern" : r"https://s1.imgpv.com/cgi-bin/dl.cgi/hmbb\w+/test-%E3%83%86%E3%82%B9%E3%83%88-%2522%26%26gt%3B.jpg", + "#sha1_content": "0c8768055e4e20e7c7259608b67799171b691140", + + "date" : "dt:2025-12-28 13:09:35", + "extension": "jpg", + "filename" : "test-ใƒ†ใ‚นใƒˆ-%22&>", + "post_url" : "https://imgpv.com/4sizkvumyh8v/test-%E3%83%86%E3%82%B9%E3%83%88-%22%2526%3E.jpg.html", + "token" : "4sizkvumyh8v", +}, + +)