[imgpv] add 'image' extractor (#8773)

This commit is contained in:
Mike Fährmann
2025-12-28 21:36:06 +01:00
parent bea0e16970
commit 4f535ec606
4 changed files with 71 additions and 0 deletions

View File

@@ -2129,6 +2129,12 @@ Consider all listed sites to potentially be NSFW.
<td>individual Images</td>
<td></td>
</tr>
<tr id="imgpv" title="imgpv">
<td>IMGPV</td>
<td>https://imgpv.com/</td>
<td>individual Images</td>
<td></td>
</tr>
<tr id="imgspice" title="imgspice">
<td>Imgspice</td>
<td>https://imgspice.com/</td>

View File

@@ -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, '<b>', '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),
}

View File

@@ -100,6 +100,7 @@ CATEGORY_MAP = {
"imgkiwi" : "IMG.Kiwi",
"imglike" : "Nude Celeb",
"imgpile" : "imgpile",
"imgpv" : "IMGPV",
"imgtaxi" : "ImgTaxi.com",
"imgth" : "imgth",
"imgur" : "imgur",

39
test/results/imgpv.py Normal file
View File

@@ -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",
},
)